Class 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 BarChart
      static 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 Charts
      static java.util.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​(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 - a String object.
        out - a OutputStream 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 - a String object.
        out - a OutputStream 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 - a String 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 - a String 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 - a String 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.