Package org.opennms.web.charts
Class ChartUtils
- java.lang.Object
-
- org.opennms.web.charts.ChartUtils
-
public abstract class ChartUtils extends Object
ChartUtils class.
- Version:
- $Id: $
- Author:
- David Hustace
-
-
Constructor Summary
Constructors Constructor Description ChartUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.jfree.chart.JFreeChartgetBarChart(String chartName)This method will returns a JFreeChart bar chart constructed based on XML configuration.static voidgetBarChart(String chartName, OutputStream out)Helper method that returns the JFreeChart to an output stream written in JPEG format.static byte[]getBarChartAsPNGByteArray(String chartName)Helper method that returns the JFreeChart as a PNG byte array.static BarChartgetBarChartConfigByName(String chartName)Helper method used to retrieve the XML defined BarChartstatic voidgetBarChartPNG(String chartName, OutputStream out)Helper method that returns the JFreeChart to an output stream written in JPEG format.static BufferedImagegetChartAsBufferedImage(String chartName)Helper method used to return a JFreeChart as a buffered Image.static Collection<BarChart>getChartCollection()Helper method used to fetch an Iterator for all defined Chartsstatic Iterator<BarChart>getChartCollectionIterator()Helper method used to fetch an Iterator for all defined Charts
-
-
-
Method Detail
-
getBarChart
public static org.jfree.chart.JFreeChart getBarChart(String chartName) throws IOException, SQLException
This method will returns a JFreeChart bar chart constructed based on XML configuration.- Parameters:
chartName- Name specified in chart-configuration.xml- Returns:
JFreeChartconstructed from the chartName- Throws:
IOException- if any.SQLException- if any.
-
getBarChart
public static void getBarChart(String chartName, OutputStream out) throws IOException, SQLException
Helper method that returns the JFreeChart to an output stream written in JPEG format.- Parameters:
chartName- aStringobject.out- aOutputStreamobject.- Throws:
IOException- if any.SQLException- if any.
-
getBarChartPNG
public static void getBarChartPNG(String chartName, OutputStream out) throws IOException, SQLException
Helper method that returns the JFreeChart to an output stream written in JPEG format.- Parameters:
chartName- aStringobject.out- aOutputStreamobject.- Throws:
IOException- if any.SQLException- if any.
-
getBarChartAsPNGByteArray
public static byte[] getBarChartAsPNGByteArray(String chartName) throws IOException, SQLException
Helper method that returns the JFreeChart as a PNG byte array.- Parameters:
chartName- aStringobject.- Returns:
- a byte array
- Throws:
IOException- if any.SQLException- if any.
-
getChartAsBufferedImage
public static BufferedImage getChartAsBufferedImage(String chartName) throws IOException, SQLException
Helper method used to return a JFreeChart as a buffered Image.- Parameters:
chartName- aStringobject.- Returns:
- a
BufferedImage - Throws:
IOException- if any.SQLException- if any.
-
getBarChartConfigByName
public static BarChart getBarChartConfigByName(String chartName) throws IOException
Helper method used to retrieve the XML defined BarChart- Parameters:
chartName- aStringobject.- Returns:
- a BarChart
- Throws:
IOException- if any.
-
getChartCollection
public static Collection<BarChart> getChartCollection() throws IOException
Helper method used to fetch an Iterator for all defined Charts- Returns:
BarChartIterator- Throws:
IOException- if any.
-
getChartCollectionIterator
public static Iterator<BarChart> getChartCollectionIterator() throws IOException
Helper method used to fetch an Iterator for all defined Charts- Returns:
BarChartIterator- Throws:
IOException- if any.
-
-