weka.classifiers.timeseries.eval.graph
Class JFreeChartDriver

java.lang.Object
  extended by weka.classifiers.timeseries.eval.graph.GraphDriver
      extended by weka.classifiers.timeseries.eval.graph.JFreeChartDriver

public class JFreeChartDriver
extends GraphDriver


Constructor Summary
JFreeChartDriver()
           
 
Method Summary
 javax.swing.JPanel getGraphPanelSteps(TSForecaster forecaster, java.util.List<ErrorModule> preds, java.lang.String targetName, java.util.List<java.lang.Integer> stepsToPlot, int instanceNumOffset, Instances data)
          Return the graph encapsulated in a JPanel.
 javax.swing.JPanel getGraphPanelTargets(TSForecaster forecaster, ErrorModule preds, java.util.List<java.lang.String> targetNames, int stepNumber, int instanceNumOffset, Instances data)
          Return the graph encapsulated in a panel.
 java.awt.Image getImageFromChart(javax.swing.JPanel chart, int width, int height)
          Get an image representation of the supplied chart.
 javax.swing.JPanel getPanelFutureForecast(TSForecaster forecaster, java.util.List<java.util.List<NumericPrediction>> preds, java.util.List<java.lang.String> targetNames, Instances history)
          Return the graph encapsulated in a JPanel
 void saveChartToFile(javax.swing.JPanel chart, java.lang.String filename, int width, int height)
          Save a chart to a file.
 
Methods inherited from class weka.classifiers.timeseries.eval.graph.GraphDriver
getDefaultDriver, getDriver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JFreeChartDriver

public JFreeChartDriver()
Method Detail

saveChartToFile

public void saveChartToFile(javax.swing.JPanel chart,
                            java.lang.String filename,
                            int width,
                            int height)
                     throws java.lang.Exception
Description copied from class: GraphDriver
Save a chart to a file.

Specified by:
saveChartToFile in class GraphDriver
Parameters:
chart - the chart to save
filename - the filename to save to
width - width of the saved image
height - height of the saved image
Throws:
java.lang.Exception - if the chart can't be saved for some reason

getImageFromChart

public java.awt.Image getImageFromChart(javax.swing.JPanel chart,
                                        int width,
                                        int height)
                                 throws java.lang.Exception
Description copied from class: GraphDriver
Get an image representation of the supplied chart.

Specified by:
getImageFromChart in class GraphDriver
Parameters:
chart - the chart to get an image of.
width - width of the chart
height - height of the chart
Returns:
an Image of the chart
Throws:
java.lang.Exception - if the image can't be created for some reason

getGraphPanelTargets

public javax.swing.JPanel getGraphPanelTargets(TSForecaster forecaster,
                                               ErrorModule preds,
                                               java.util.List<java.lang.String> targetNames,
                                               int stepNumber,
                                               int instanceNumOffset,
                                               Instances data)
                                        throws java.lang.Exception
Description copied from class: GraphDriver
Return the graph encapsulated in a panel.

Specified by:
getGraphPanelTargets in class GraphDriver
Parameters:
forecaster - the forecaster
preds - an ErrorModule that contains predictions for all targets for the specified step ahead. Targets are in the same order returned by TSForecaster.getFieldsToForecast()
targetNames - the list of target names to plot
stepNumber - which step ahead to graph for specified targets
instanceNumOffset - how far into the data the predictions start from
data - the instances that these predictions correspond to (may be null)
Returns:
an image of the graph
Throws:
java.lang.Exception

getGraphPanelSteps

public javax.swing.JPanel getGraphPanelSteps(TSForecaster forecaster,
                                             java.util.List<ErrorModule> preds,
                                             java.lang.String targetName,
                                             java.util.List<java.lang.Integer> stepsToPlot,
                                             int instanceNumOffset,
                                             Instances data)
                                      throws java.lang.Exception
Description copied from class: GraphDriver
Return the graph encapsulated in a JPanel.

Specified by:
getGraphPanelSteps in class GraphDriver
Parameters:
forecaster - the forecaster
preds - a list of ErrorModules, one for each consecutive step ahead prediction set
targetName - the name of the target field to plot
stepsToPlot - a list of step numbers for the step-ahead prediction sets to plot to plot for the specified target.
instanceNumOffset - how far into the data the predictions start from
data - the instances that these predictions correspond to (may be null)
Returns:
an image of the graph.
Throws:
java.lang.Exception

getPanelFutureForecast

public javax.swing.JPanel getPanelFutureForecast(TSForecaster forecaster,
                                                 java.util.List<java.util.List<NumericPrediction>> preds,
                                                 java.util.List<java.lang.String> targetNames,
                                                 Instances history)
                                          throws java.lang.Exception
Description copied from class: GraphDriver
Return the graph encapsulated in a JPanel

Specified by:
getPanelFutureForecast in class GraphDriver
Parameters:
forecaster - the forecaster
preds - a list of list of predictions for *all* targets. The outer list is indexed by step number (i.e. the first entry is the 1-step ahead forecasts, the second is the 2-steps ahead forecasts etc.) and the inner list is indexed by target in the same order as the list of targets returned by TSForecaster.getFieldsToForecast().
targetNames - the list of target names to plot
history - a set of instances from which predictions are assumed to follow on from. May be null, in which case just the predictions are plotted.
Returns:
an image of the graph
Throws:
java.lang.Exception