Fairness.Graphing
Class Graph

java.lang.Object
  extended by Fairness.Graphing.Graph

public class Graph
extends java.lang.Object

Graph represents a graphical plot of 1 to 4 data series. A graph is created and customized entirely through its constructor, then the image for the graph can be written to a file.


Constructor Summary
Graph(java.lang.String title, java.lang.String leftLabel, java.lang.String bottomLabel, java.util.List<? extends NamedXYSeries> data, GraphBounds bounds)
          Constructs a new customized Graph.
 
Method Summary
 edu.rit.swing.Displayable getDisplayable()
          Returns the Displayable graph object so that the Graph can be used in alternate rendering contexts.
 void writeColorPng(java.io.File outputFile)
          Writes to the given file a color PNG image of the graph.
 void writePostscript(java.io.File outputFile)
          Writes to the given file a postscript image of the graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph

public Graph(java.lang.String title,
             java.lang.String leftLabel,
             java.lang.String bottomLabel,
             java.util.List<? extends NamedXYSeries> data,
             GraphBounds bounds)
Constructs a new customized Graph. The named of the series is used to build a legend at the bottom of the graph. Currently only up to 4 series are supported.

Parameters:
title - non-null String with graph title
leftLabel - non-null String with y axis label
bottomLabel - non-null String with x axis label
data - non-null List of 1 to 4 NamedXYSeries
bounds - non-null GraphBounds
Method Detail

getDisplayable

public edu.rit.swing.Displayable getDisplayable()
Returns the Displayable graph object so that the Graph can be used in alternate rendering contexts.


writeColorPng

public void writeColorPng(java.io.File outputFile)
                   throws java.io.IOException
Writes to the given file a color PNG image of the graph. The generated image is always 728 by 748 pixels.

Parameters:
outputFile - non-null location of file to write
Throws:
java.io.IOException - if an error occurs trying to write the file

writePostscript

public void writePostscript(java.io.File outputFile)
                     throws java.io.IOException
Writes to the given file a postscript image of the graph. The generated image is always 728 by 748 pixels.

Parameters:
outputFile - non-null location of file to write
Throws:
java.io.IOException - if an error occurs trying to write the file