org.opennms.netmgt.charts
Class ChartUtils

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

public class ChartUtils
extends Object

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 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
org.exolab.castor.xml.ValidationException
IOException
SQLException

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 -
out -
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
SQLException

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 -
out -
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
SQLException

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 -
Returns:
a byte array
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
SQLException

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 -
Returns:
a BufferedImage
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
SQLException

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 -
Returns:
a derived Castor class: BarChart
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException

getChartCollectionIterator

public static Iterator 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
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException


Copyright © 2009. All Rights Reserved.