peakml.graphics
Class JFreeChartTools

java.lang.Object
  extended by peakml.graphics.JFreeChartTools

public class JFreeChartTools
extends java.lang.Object

This class offers an interface for dealing with JFreeChart graphs. Most notably methods are provided for exporting the graphs to files.


Field Summary
static int PDF
          Write in the PDF format, which has the graphics in vector format.
static int PNG
          Write in the PNG format, which is pixel-based but readable anywhere.
 
Constructor Summary
JFreeChartTools()
           
 
Method Summary
static void writeAs(int filetype, java.io.OutputStream out, org.jfree.chart.JFreeChart chart, int width, int height)
          General access method, which can be plugged with the filetype to write to.
static void writeAsPDF(java.io.OutputStream out, org.jfree.chart.JFreeChart chart, int width, int height)
          This method writes the given graph to the output stream in the PDF format.
static void writeAsPNG(java.io.OutputStream out, org.jfree.chart.JFreeChart chart, int width, int height)
          This method writes the given graph to the output stream in the PNG format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PDF

public static final int PDF
Write in the PDF format, which has the graphics in vector format.

See Also:
Constant Field Values

PNG

public static final int PNG
Write in the PNG format, which is pixel-based but readable anywhere.

See Also:
Constant Field Values
Constructor Detail

JFreeChartTools

public JFreeChartTools()
Method Detail

writeAs

public static void writeAs(int filetype,
                           java.io.OutputStream out,
                           org.jfree.chart.JFreeChart chart,
                           int width,
                           int height)
                    throws java.io.IOException
General access method, which can be plugged with the filetype to write to. This method links through to writeAsPDF(OutputStream, JFreeChart, int, int) and writeAsPNG(OutputStream, JFreeChart, int, int).

Parameters:
filetype - The type of file to write.
out - The output stream to write to.
chart - The chart to be written.
width - The width of the image.
height - The height of the image.
Throws:
java.io.IOException - Thrown when an error occurs with the IO.

writeAsPDF

public static void writeAsPDF(java.io.OutputStream out,
                              org.jfree.chart.JFreeChart chart,
                              int width,
                              int height)
                       throws java.io.IOException
This method writes the given graph to the output stream in the PDF format. As a vector based file format it allows some freedom to be changed (e.g. colors, line thickness, etc.), which can be convenient for presentation purposes.

Parameters:
out - The output stream to write to.
chart - The chart to be written.
width - The width of the image.
height - The height of the image.
Throws:
java.io.IOException - Thrown when an error occurs with the IO.

writeAsPNG

public static void writeAsPNG(java.io.OutputStream out,
                              org.jfree.chart.JFreeChart chart,
                              int width,
                              int height)
                       throws java.io.IOException
This method writes the given graph to the output stream in the PNG format.

Parameters:
out - The output stream to write to.
chart - The chart to be written.
width - The width of the image.
height - The height of the image.
Throws:
java.io.IOException - Thrown when an error occurs with the IO.