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

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.StackedBarChartPlotter
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 StackedBarChartPlotter
extends MTBOperator

Operator that generates stacked bar 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 stacked bar plot from the data. It 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 item to be displayed, i.e., for each column to appear in the plot, and a list of row indizes or 'indicators' with corresponding values which should be plotted for each item. Note that the row indizes for different items should be identical.

For an example how the data should look like, consider the following: assume that we are given three different experimental settings e1, e2 and e3, and for each setting we acquire four measurements (or 'indicators' in this context), denoted m1, m2, m3 and m4. To visualize the data in a stacked bar plot we have to pass a hash map to the operator containing three key-value pairs, one for each experimental setting:
[e1, hash_1] , [e2, hash_2], [e3, hash_3]
In each hash key-value pairs are expected specifying the values for the different indicators in the experiment, e.g., hash_1 should contain the following elements:
[m1, 'value of m1 in e1'], ..., [m4, 'value of m4 in e1']

For details on stacked bar plots in JFreeChart, e.g., refer to
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.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  String chartTitle
          Title of the chart.
protected  HashMap<String,HashMap<String,Double>> data
          Data to display.
protected  org.jfree.chart.JFreeChart stackedBarChart
          Resulting stacked bar chart.
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
StackedBarChartPlotter()
          Default constructor.
 
Method Summary
 org.jfree.chart.JFreeChart getChart()
          Get reference to resulting chart.
protected  void operate()
           
 void setData(HashMap<String,HashMap<String,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,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.


stackedBarChart

@Parameter(label="Chart Plot",
           dataIOOrder=1,
           direction=OUT,
           description="Resulting chart plot.",
           mode=STANDARD)
protected org.jfree.chart.JFreeChart stackedBarChart
Resulting stacked bar chart.

Constructor Detail

StackedBarChartPlotter

public StackedBarChartPlotter()
                       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,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.