org.opennms.netmgt.charts
Class ChartUtils

java.lang.Object
  extended by org.opennms.netmgt.charts.ChartUtils

public class ChartUtils
extends Object

ChartUtils class.

Version:
$Id: $
Author:
David Hustace

Constructor Summary
ChartUtils()
           
 
Method Summary
static org.jfree.chart.JFreeChart getBarChart(String chartName)
          This method will returns a JFreeChart bar chart constructed based on XML configuration.
static void getBarChart(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 BarChart getBarChartConfigByName(String chartName)
          Helper method used to retrieve the XML defined BarChart (castor class)
static void getBarChartPNG(String chartName, OutputStream out)
          Helper method that returns the JFreeChart to an output stream written in JPEG format.
static BufferedImage getChartAsBufferedImage(String chartName)
          Helper method used to return a JFreeChart as a buffered Image.
static Iterator<BarChart> getChartCollectionIterator()
          Helper method used to fetch an Iterator for all defined Charts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartUtils

public ChartUtils()
Method Detail

getBarChart

public static org.jfree.chart.JFreeChart getBarChart(String chartName)
                                              throws org.exolab.castor.xml.MarshalException,
                                                     org.exolab.castor.xml.ValidationException,
                                                     IOException,
                                                     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:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.
SQLException - if any.

getBarChart

public static void getBarChart(String chartName,
                               OutputStream out)
                        throws org.exolab.castor.xml.MarshalException,
                               org.exolab.castor.xml.ValidationException,
                               IOException,
                               SQLException
Helper method that returns the JFreeChart to an output stream written in JPEG format.

Parameters:
chartName - a String object.
out - a OutputStream object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.
SQLException - if any.

getBarChartPNG

public static void getBarChartPNG(String chartName,
                                  OutputStream out)
                           throws org.exolab.castor.xml.MarshalException,
                                  org.exolab.castor.xml.ValidationException,
                                  IOException,
                                  SQLException
Helper method that returns the JFreeChart to an output stream written in JPEG format.

Parameters:
chartName - a String object.
out - a OutputStream object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.
SQLException - if any.

getBarChartAsPNGByteArray

public static byte[] getBarChartAsPNGByteArray(String chartName)
                                        throws org.exolab.castor.xml.MarshalException,
                                               org.exolab.castor.xml.ValidationException,
                                               IOException,
                                               SQLException
Helper method that returns the JFreeChart as a PNG byte array.

Parameters:
chartName - a String object.
Returns:
a byte array
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.
SQLException - if any.

getChartAsBufferedImage

public static BufferedImage getChartAsBufferedImage(String chartName)
                                             throws org.exolab.castor.xml.MarshalException,
                                                    org.exolab.castor.xml.ValidationException,
                                                    IOException,
                                                    SQLException
Helper method used to return a JFreeChart as a buffered Image.

Parameters:
chartName - a String object.
Returns:
a BufferedImage
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.
SQLException - if any.

getBarChartConfigByName

public static BarChart getBarChartConfigByName(String chartName)
                                        throws org.exolab.castor.xml.MarshalException,
                                               org.exolab.castor.xml.ValidationException,
                                               IOException
Helper method used to retrieve the XML defined BarChart (castor class)

Parameters:
chartName - a String object.
Returns:
a derived Castor class: BarChart
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.

getChartCollectionIterator

public static Iterator<BarChart> getChartCollectionIterator()
                                                     throws IOException,
                                                            org.exolab.castor.xml.MarshalException,
                                                            org.exolab.castor.xml.ValidationException
Helper method used to fetch an Iterator for all defined Charts

Returns:
BarChart Iterator
Throws:
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.


Copyright © 2011. All Rights Reserved.