de.unihalle.informatik.MiToBo.visualization.plots
Class BoxWhiskerChartPlotter

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.visualization.plots.BoxWhiskerChartPlotter
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=NONE,
              level=STANDARD,
              allowBatchMode=false)
public class BoxWhiskerChartPlotter
extends MTBOperator

Operator that generates box-whisker plots using JFreeChart.

For details on the library take a look here: http://www.jfree.org/jfreechart/

The operator takes input data and generates a box-whisker plot of the data, optionally grouping the boxes into different categories. In addition, the operator provides various parameters to adjust the plot's appearance, like title of the plot, axes labels, or the font size of the tick labels on the axes.

As input data the operator takes a hash map which should contain a key for each category to be displayed, i.e., each group of boxes to appear in the plot, and as values the corresponding data. The data is also expected to be arranged in a hash map where the key string indicates the name of the variable or indicator, and the values are given in terms of a list of doubles.

For an example how the data should look like, consider the following: assume that we are given two groups of cells, i.e., two categories g1 and g2, and each group contains 30 elements. For each element two measurements (or 'indicators' in this context) are given, denoted m1 and m2. We would like to visualize for each group the distribution of the two measurements, i.e., get a box plot with two categories and two boxes in each category. Consequently, we have to pass a hash map to the operator containing two key-value pairs, one for each category or group, respectively:
[g1, hash_1] , [g2, hash_2]
In each group hash, key-value pairs are expected where the key refers to the indicator and the value, given in terms of a list, contains the measurements of the indicator for the elements of that group. In this example each hash, thus, contains two key-value pairs where the keys are given by m1 and m2, and each value is given by a list of 30 double entries:
[m1, [v1, ..., v30] ] , [m2, [v1, ..., v30] ]

For more details on box-whisker plots in JFreeChart, e.g., refer to
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.html

Author:
moeller

Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
protected  org.jfree.chart.JFreeChart boxWhiskerChart
          Resulting box-whisker chart.
protected  String chartTitle
          Title of the chart.
protected  HashMap<String,HashMap<String,LinkedList<Double>>> data
          Data to display.
protected  int tickLabelSize
          Size of axes' tick labels.
protected  String xLabel
          Label of the x-axis.
protected  String yLabel
          Label of the y-axis.
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
BoxWhiskerChartPlotter()
          Default constructor.
 
Method Summary
 org.jfree.chart.JFreeChart getChart()
          Get reference to resulting chart.
protected  void operate()
           
 void setData(HashMap<String,HashMap<String,LinkedList<Double>>> d)
          Set the data to plot.
 void setTickLabelSize(int size)
          Set size of tick labels on both axes.
 void setTitle(String title)
          Set title of chart plot.
 void setXAxisLabel(String xlabel)
          Set label of x-axis.
 void setYAxisLabel(String ylabel)
          Set label of y-axis.
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

@Parameter(label="Data",
           required=true,
           dataIOOrder=-1,
           direction=IN,
           description="Data.",
           mode=STANDARD)
protected HashMap<String,HashMap<String,LinkedList<Double>>> data
Data to display.


chartTitle

@Parameter(label="Chart title",
           required=false,
           dataIOOrder=1,
           direction=IN,
           description="Chart title.",
           mode=STANDARD)
protected String chartTitle
Title of the chart.


xLabel

@Parameter(label="X-axis label",
           required=false,
           dataIOOrder=2,
           direction=IN,
           description="Label of x-axis.",
           mode=STANDARD)
protected String xLabel
Label of the x-axis.


yLabel

@Parameter(label="Y-axis label",
           required=false,
           dataIOOrder=3,
           direction=IN,
           description="Label of y-axis.",
           mode=STANDARD)
protected String yLabel
Label of the y-axis.


tickLabelSize

@Parameter(label="Tick label size",
           required=false,
           dataIOOrder=4,
           direction=IN,
           mode=STANDARD,
           description="Size of tick labels on both axes.")
protected int tickLabelSize
Size of axes' tick labels.


boxWhiskerChart

@Parameter(label="Box-whisker chart plot",
           dataIOOrder=1,
           direction=OUT,
           description="Resulting plot.",
           mode=STANDARD)
protected org.jfree.chart.JFreeChart boxWhiskerChart
Resulting box-whisker chart.

Constructor Detail

BoxWhiskerChartPlotter

public BoxWhiskerChartPlotter()
                       throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Default constructor.

Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

setData

public void setData(HashMap<String,HashMap<String,LinkedList<Double>>> d)
Set the data to plot.

Parameters:
d - Data to plot.

setTitle

public void setTitle(String title)
Set title of chart plot.

Parameters:
title - Title string.

setXAxisLabel

public void setXAxisLabel(String xlabel)
Set label of x-axis.

Parameters:
xlabel - Label string.

setYAxisLabel

public void setYAxisLabel(String ylabel)
Set label of y-axis.

Parameters:
ylabel - Label string.

setTickLabelSize

public void setTickLabelSize(int size)
Set size of tick labels on both axes.

Parameters:
size - Size of tick labels.

getChart

public org.jfree.chart.JFreeChart getChart()
Get reference to resulting chart.

Returns:
Generated chart plot.

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.