Package org.opennms.web.charts
Class ChartUtils
- java.lang.Object
-
- org.opennms.web.charts.ChartUtils
-
public abstract class ChartUtils extends java.lang.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.JFreeChart
getBarChart(java.lang.String chartName)
This method will returns a JFreeChart bar chart constructed based on XML configuration.static void
getBarChart(java.lang.String chartName, java.io.OutputStream out)
Helper method that returns the JFreeChart to an output stream written in JPEG format.static byte[]
getBarChartAsPNGByteArray(java.lang.String chartName)
Helper method that returns the JFreeChart as a PNG byte array.static BarChart
getBarChartConfigByName(java.lang.String chartName)
Helper method used to retrieve the XML defined BarChartstatic void
getBarChartPNG(java.lang.String chartName, java.io.OutputStream out)
Helper method that returns the JFreeChart to an output stream written in JPEG format.static java.awt.image.BufferedImage
getChartAsBufferedImage(java.lang.String chartName)
Helper method used to return a JFreeChart as a buffered Image.static java.util.Collection<BarChart>
getChartCollection()
Helper method used to fetch an Iterator for all defined Chartsstatic java.util.Iterator<BarChart>
getChartCollectionIterator()
Helper method used to fetch an Iterator for all defined Charts
-
-
-
Method Detail
-
getBarChart
public static org.jfree.chart.JFreeChart getBarChart(java.lang.String chartName) throws java.io.IOException, java.sql.SQLException
This method will returns a JFreeChart bar chart constructed based on XML configuration.- Parameters:
chartName
- Name specified in chart-configuration.xml- Returns:
JFreeChart
constructed from the chartName- Throws:
java.io.IOException
- if any.java.sql.SQLException
- if any.
-
getBarChart
public static void getBarChart(java.lang.String chartName, java.io.OutputStream out) throws java.io.IOException, java.sql.SQLException
Helper method that returns the JFreeChart to an output stream written in JPEG format.- Parameters:
chartName
- aString
object.out
- aOutputStream
object.- Throws:
java.io.IOException
- if any.java.sql.SQLException
- if any.
-
getBarChartPNG
public static void getBarChartPNG(java.lang.String chartName, java.io.OutputStream out) throws java.io.IOException, java.sql.SQLException
Helper method that returns the JFreeChart to an output stream written in JPEG format.- Parameters:
chartName
- aString
object.out
- aOutputStream
object.- Throws:
java.io.IOException
- if any.java.sql.SQLException
- if any.
-
getBarChartAsPNGByteArray
public static byte[] getBarChartAsPNGByteArray(java.lang.String chartName) throws java.io.IOException, java.sql.SQLException
Helper method that returns the JFreeChart as a PNG byte array.- Parameters:
chartName
- aString
object.- Returns:
- a byte array
- Throws:
java.io.IOException
- if any.java.sql.SQLException
- if any.
-
getChartAsBufferedImage
public static java.awt.image.BufferedImage getChartAsBufferedImage(java.lang.String chartName) throws java.io.IOException, java.sql.SQLException
Helper method used to return a JFreeChart as a buffered Image.- Parameters:
chartName
- aString
object.- Returns:
- a
BufferedImage
- Throws:
java.io.IOException
- if any.java.sql.SQLException
- if any.
-
getBarChartConfigByName
public static BarChart getBarChartConfigByName(java.lang.String chartName) throws java.io.IOException
Helper method used to retrieve the XML defined BarChart- Parameters:
chartName
- aString
object.- Returns:
- a BarChart
- Throws:
java.io.IOException
- if any.
-
getChartCollection
public static java.util.Collection<BarChart> getChartCollection() throws java.io.IOException
Helper method used to fetch an Iterator for all defined Charts- Returns:
BarChart
Iterator- Throws:
java.io.IOException
- if any.
-
getChartCollectionIterator
public static java.util.Iterator<BarChart> getChartCollectionIterator() throws java.io.IOException
Helper method used to fetch an Iterator for all defined Charts- Returns:
BarChart
Iterator- Throws:
java.io.IOException
- if any.
-
-