org.expasy.jpl.commons.collection.render
Class HistogramDataSetRenderer

java.lang.Object
  extended by org.expasy.jpl.commons.collection.render.HistogramDataSetRenderer
All Implemented Interfaces:
ChartRenderer

public final class HistogramDataSetRenderer
extends Object
implements ChartRenderer

This object renders HistogramDataSet objects.

Version:
1.0
Author:
nikitin

Method Summary
 void addDataSet(HistogramDataSet histo, String title)
          Add the statistical data set (default colors: 1st serie (blue), 2nd serie (red)).
 void addDataSet(HistogramDataSet histo, String title, Color color)
          Add the statistical data set.
 void clearDataSet()
          Empty data set.
 void disableBinRenderMode()
          All the values will be rendered (slow down rendering if lots of data).
 void enableBinRenderMode()
          The values of all bins will be added for rendering (quick rendering).
 void exportChart(HistogramDataSet histo, String title, String filename)
          Export as image file.
 void exportChart(String filename)
          Export a chart (prerequisite: data sets have already been entered via addDataSet method).
 Paint getChartColor(int chartIndex)
          get the color of ith chart
 ImageFormat getImageFormat()
          Get image format.
 org.jfree.chart.ChartRenderingInfo getRenderingInfo()
          Retrieve rendering info (for interactive graphs).
static HistogramDataSetRenderer newInstance()
           
 BufferedImage render()
          Create an image (prerequisite: data sets have already been entered via addDataSet method).
 BufferedImage render(HistogramDataSet histo, String title)
          Create an image corresponding to the given MS spectrum.
 void setBackgroundColor(Paint color)
          Set plot background color.
 void setChartColor(int chartIndex, Paint color)
          set the color of ith chart
 void setDimension(Dimension dim)
          Set image dimension.
 void setImageFormat(ImageFormat format)
          Set image format.
 void setXAxisDefaultInterval()
           
 void setXAxisInterval(double from, double to)
          set the x-axis interval to render
 void setXAxisLegend(String legend)
          Set the legend for the var axis.
 void setYAxisLegend(String legend)
          Set the legend for the frequency axis.
static org.jfree.data.xy.IntervalXYDataset toXYDataset(HistogramDataSetExporter exporter, String title, HistogramDataSet histo)
          Convert the histogram for jfreechart display (add values and weights).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static HistogramDataSetRenderer newInstance()

enableBinRenderMode

public void enableBinRenderMode()
The values of all bins will be added for rendering (quick rendering).


disableBinRenderMode

public void disableBinRenderMode()
All the values will be rendered (slow down rendering if lots of data).


setBackgroundColor

public void setBackgroundColor(Paint color)
Set plot background color.

Specified by:
setBackgroundColor in interface ChartRenderer
Parameters:
color - the background color.

setDimension

public void setDimension(Dimension dim)
Set image dimension.

Specified by:
setDimension in interface ChartRenderer
Parameters:
dim - the image dimension.

setImageFormat

public void setImageFormat(ImageFormat format)
Set image format.

Parameters:
format - the image format (png or jpeg).

getImageFormat

public ImageFormat getImageFormat()
Get image format.

Specified by:
getImageFormat in interface ChartRenderer
Returns:
format the image format (png or jpeg).

setXAxisLegend

public void setXAxisLegend(String legend)
Set the legend for the var axis.

Specified by:
setXAxisLegend in interface ChartRenderer
Parameters:
legend - the x-axis legend.

setYAxisLegend

public void setYAxisLegend(String legend)
Set the legend for the frequency axis.

Specified by:
setYAxisLegend in interface ChartRenderer
Parameters:
legend - the y-axis legend.

clearDataSet

public void clearDataSet()
Empty data set.


addDataSet

public void addDataSet(HistogramDataSet histo,
                       String title)
Add the statistical data set (default colors: 1st serie (blue), 2nd serie (red)).

Parameters:
statSerie - the statistical serie to render.
title - the title associated to the data set.

addDataSet

public void addDataSet(HistogramDataSet histo,
                       String title,
                       Color color)
Add the statistical data set.

Parameters:
statSerie - the statistical serie to render.
title - the title associated to the data set.
color - the color of the serie.

render

public BufferedImage render(HistogramDataSet histo,
                            String title)
Create an image corresponding to the given MS spectrum.

Parameters:
pl - the peak list to render.
title - the image title.
Returns:
a new buffered image.

getRenderingInfo

public org.jfree.chart.ChartRenderingInfo getRenderingInfo()
Retrieve rendering info (for interactive graphs).

Returns:
the rendering information associated to the chart.

exportChart

public void exportChart(HistogramDataSet histo,
                        String title,
                        String filename)
Export as image file.

Parameters:
statSerie - the statistical serie to render and export.
dir - the directory to put new file in.
title - the file name.

render

public BufferedImage render()
Create an image (prerequisite: data sets have already been entered via addDataSet method).

Specified by:
render in interface ChartRenderer
Returns:
a new buffered image.

exportChart

public void exportChart(String filename)
Export a chart (prerequisite: data sets have already been entered via addDataSet method).

Specified by:
exportChart in interface ChartRenderer
Parameters:
filename - the image file name without extension (defined in ImageFormat).

setChartColor

public void setChartColor(int chartIndex,
                          Paint color)
Description copied from interface: ChartRenderer
set the color of ith chart

Specified by:
setChartColor in interface ChartRenderer

getChartColor

public Paint getChartColor(int chartIndex)
Description copied from interface: ChartRenderer
get the color of ith chart

Specified by:
getChartColor in interface ChartRenderer

toXYDataset

public static org.jfree.data.xy.IntervalXYDataset toXYDataset(HistogramDataSetExporter exporter,
                                                              String title,
                                                              HistogramDataSet histo)
Convert the histogram for jfreechart display (add values and weights).

Parameters:
title - the title of the histogram.
isLoadBinData - true if load bin centers instead of data.
Returns:
an instance of IntervalXYDataset.

setXAxisDefaultInterval

public void setXAxisDefaultInterval()
Specified by:
setXAxisDefaultInterval in interface ChartRenderer

setXAxisInterval

public void setXAxisInterval(double from,
                             double to)
Description copied from interface: ChartRenderer
set the x-axis interval to render

Specified by:
setXAxisInterval in interface ChartRenderer


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.