userinterface.gui.graphHandler
Class XYGraphConstructor

java.lang.Object
  extended by userinterface.gui.graphHandler.XYGraphConstructor

public class XYGraphConstructor
extends java.lang.Object

Class for the generation and displaying of an XY graph with JFreeChart Provides methods for generating a plot from a file, but also for direct adding of number pairs or a whole list of number pairs

Author:
Stefanie Kaufmann

Constructor Summary
XYGraphConstructor(java.lang.String title, java.lang.String xlabel, java.lang.String ylabel)
          Constructs an empty graph constructor with a given title and axis labels
 
Method Summary
 void addData(double x, java.util.ArrayList<java.lang.Double> y)
          Adds a number of numerical (x,y) pairs to the graph, but only if the number is the same as the number of existing series; this method should be used after 'addEmptySeries' to ensure no messing up of data that does not belong together
 void addData(double x, double y)
          Adds one single numerical pair to the graph, but only if there is only one series of data; this method should be used after 'addEmptySeries' to ensure no messing up of data that does not belong together
 void addEmptySeries(java.util.ArrayList<java.lang.String> titles)
          Creates a number of empty series and adds them to those yet existing
 void addEmptySeries(java.lang.String title)
          Creates one empty series and adds them to the existing ones
 void addSeries(Tupel<java.lang.Double,? extends java.lang.Number>[] list, java.lang.String title)
          Adds a list of numerical pairs to the graph
 void generateGraph()
          Generates a graph from the loaded data and displays it
 void readInData(java.io.File dataSource)
          Reads in data from a given file and prepares it for plotting Structure of the input file has to be tabular, with first column giving the x-axis value, other columns giving corresponding y-axis values
 void saveGraph(java.io.File output)
          Saves the graph as a JPEG picture
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XYGraphConstructor

public XYGraphConstructor(java.lang.String title,
                          java.lang.String xlabel,
                          java.lang.String ylabel)
Constructs an empty graph constructor with a given title and axis labels

Parameters:
title -
xlabel -
ylabel -
Method Detail

readInData

public void readInData(java.io.File dataSource)
Reads in data from a given file and prepares it for plotting Structure of the input file has to be tabular, with first column giving the x-axis value, other columns giving corresponding y-axis values

Parameters:
dataSource - A file containing data to be plotted

addSeries

public void addSeries(Tupel<java.lang.Double,? extends java.lang.Number>[] list,
                      java.lang.String title)
Adds a list of numerical pairs to the graph

Parameters:
list - A list of numerical pairs/tuples
title - The title of the list

addData

public void addData(double x,
                    double y)
Adds one single numerical pair to the graph, but only if there is only one series of data; this method should be used after 'addEmptySeries' to ensure no messing up of data that does not belong together

Parameters:
x - The x-axis value
y - The y-axis value

addData

public void addData(double x,
                    java.util.ArrayList<java.lang.Double> y)
Adds a number of numerical (x,y) pairs to the graph, but only if the number is the same as the number of existing series; this method should be used after 'addEmptySeries' to ensure no messing up of data that does not belong together

Parameters:
x -
y -

addEmptySeries

public void addEmptySeries(java.util.ArrayList<java.lang.String> titles)
Creates a number of empty series and adds them to those yet existing

Parameters:
titles - A number of titles for the empty series

addEmptySeries

public void addEmptySeries(java.lang.String title)
Creates one empty series and adds them to the existing ones

Parameters:
title - The title of this series

generateGraph

public void generateGraph()
Generates a graph from the loaded data and displays it


saveGraph

public void saveGraph(java.io.File output)
Saves the graph as a JPEG picture

Parameters:
output - The output file where it will be saved