Header
And More


org.jfree.chart.renderer.xy
Class DeviationRenderer

java.lang.Object
  extended by org.jfree.chart.renderer.AbstractRenderer
      extended by org.jfree.chart.renderer.xy.AbstractXYItemRenderer
          extended by org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
              extended by org.jfree.chart.renderer.xy.DeviationRenderer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, LegendItemSource, XYItemRenderer, org.jfree.util.PublicCloneable

public class DeviationRenderer
extends XYLineAndShapeRenderer

A specialised subclass of the XYLineAndShapeRenderer that requires an IntervalXYDataset and represents the y-interval by shading an area behind the y-values on the chart. The example shown here is generated by the DeviationRendererDemo1.java program included in the JFreeChart demo collection:

DeviationRendererSample.png

Since:
1.0.5
See Also:
Serialized Form

Nested Class Summary
static class DeviationRenderer.State
          A state object that is passed to each call to drawItem.
 
Field Summary
 
Fields inherited from class org.jfree.chart.renderer.AbstractRenderer
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO
 
Constructor Summary
DeviationRenderer()
          Creates a new renderer that displays lines and shapes for the data items, as well as the shaded area for the y-interval.
DeviationRenderer(boolean lines, boolean shapes)
          Creates a new renderer.
 
Method Summary
 void drawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
          Draws the visual representation of a single data item.
 boolean equals(java.lang.Object obj)
          Tests this renderer for equality with an arbitrary object.
 Range findRangeBounds(XYDataset dataset)
          Returns the range of values the renderer requires to display all the items from the specified dataset.
 float getAlpha()
          Returns the alpha transparency for the background shading.
 int getPassCount()
          Returns the number of passes (through the dataset) used by this renderer.
 XYItemRendererState initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info)
          Initialises and returns a state object that can be passed to each invocation of the drawItem(java.awt.Graphics2D, org.jfree.chart.renderer.xy.XYItemRendererState, java.awt.geom.Rectangle2D, org.jfree.chart.plot.PlotRenderingInfo, org.jfree.chart.plot.XYPlot, org.jfree.chart.axis.ValueAxis, org.jfree.chart.axis.ValueAxis, org.jfree.data.xy.XYDataset, int, int, org.jfree.chart.plot.CrosshairState, int) method.
protected  boolean isItemPass(int pass)
          Returns true if this is the pass where the shapes are drawn.
protected  boolean isLinePass(int pass)
          Returns true if this is the pass where the lines are drawn.
 void setAlpha(float alpha)
          Sets the alpha transparency for the background shading, and sends a RendererChangeEvent to all registered listeners.
 void setDrawSeriesLineAsPath(boolean flag)
          This method is overridden so that this flag cannot be changed---it is set to true for this renderer.
 
Methods inherited from class org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
clone, drawFirstPassShape, drawPrimaryLine, drawPrimaryLineAsPath, drawSecondaryPass, getBaseLinesVisible, getBaseShapesFilled, getBaseShapesVisible, getDrawOutlines, getDrawSeriesLineAsPath, getItemLineVisible, getItemShapeFilled, getItemShapeVisible, getLegendItem, getLegendLine, getLinesVisible, getSeriesLinesVisible, getSeriesShapesFilled, getSeriesShapesVisible, getShapesVisible, getUseFillPaint, getUseOutlinePaint, setBaseLinesVisible, setBaseShapesFilled, setBaseShapesVisible, setDrawOutlines, setLegendLine, setLinesVisible, setLinesVisible, setSeriesLinesVisible, setSeriesLinesVisible, setSeriesShapesFilled, setSeriesShapesFilled, setSeriesShapesVisible, setSeriesShapesVisible, setShapesFilled, setShapesFilled, setShapesVisible, setShapesVisible, setUseFillPaint, setUseOutlinePaint
 
Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer
addAnnotation, addAnnotation, addEntity, calculateDomainMarkerTextAnchorPoint, drawAnnotations, drawDomainGridLine, drawDomainLine, drawDomainMarker, drawItemLabel, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, findDomainBounds, findRangeBounds, getAnnotations, getBaseItemLabelGenerator, getBaseToolTipGenerator, getDrawingSupplier, getItemLabelGenerator, getItemLabelGenerator, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, getURLGenerator, isPointInRect, removeAnnotation, removeAnnotations, setBaseItemLabelGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setToolTipGenerator, setURLGenerator, updateCrosshairValues, updateCrosshairValues
 
Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, calculateLabelAnchorPoint, clearSeriesPaints, clearSeriesStrokes, fireChangeEvent, getAutoPopulateSeriesFillPaint, getAutoPopulateSeriesOutlinePaint, getAutoPopulateSeriesOutlineStroke, getAutoPopulateSeriesPaint, getAutoPopulateSeriesShape, getAutoPopulateSeriesStroke, getBaseCreateEntities, getBaseFillPaint, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseLegendShape, getBaseLegendTextFont, getBaseLegendTextPaint, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getCreateEntities, getDataBoundsIncludesVisibleSeriesOnly, getDefaultEntityRadius, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendShape, getLegendTextFont, getLegendTextPaint, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, hashCode, hasListener, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, lookupLegendShape, lookupLegendTextFont, lookupLegendTextPaint, lookupSeriesFillPaint, lookupSeriesOutlinePaint, lookupSeriesOutlineStroke, lookupSeriesPaint, lookupSeriesShape, lookupSeriesStroke, notifyListeners, removeChangeListener, setAutoPopulateSeriesFillPaint, setAutoPopulateSeriesOutlinePaint, setAutoPopulateSeriesOutlineStroke, setAutoPopulateSeriesPaint, setAutoPopulateSeriesShape, setAutoPopulateSeriesStroke, setBaseCreateEntities, setBaseCreateEntities, setBaseFillPaint, setBaseFillPaint, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseLegendShape, setBaseLegendTextFont, setBaseLegendTextPaint, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setCreateEntities, setCreateEntities, setDataBoundsIncludesVisibleSeriesOnly, setDefaultEntityRadius, setFillPaint, setFillPaint, setItemLabelAnchorOffset, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setLegendShape, setLegendTextFont, setLegendTextPaint, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlinePaint, setOutlineStroke, setOutlineStroke, setPaint, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setShape, setStroke, setStroke
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.chart.renderer.xy.XYItemRenderer
addAnnotation, addAnnotation, addChangeListener, drawAnnotations, drawDomainGridLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, getBaseItemLabelFont, getBaseItemLabelGenerator, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getBaseToolTipGenerator, getItemLabelFont, getItemLabelFont, getItemLabelGenerator, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendItemLabelGenerator, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPlot, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelGenerator, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesToolTipGenerator, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, getToolTipGenerator, getURLGenerator, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeAnnotation, removeAnnotations, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelGenerator, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseStroke, setBaseToolTipGenerator, setItemLabelFont, setItemLabelGenerator, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setLegendItemLabelGenerator, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlineStroke, setPaint, setPlot, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesItemLabelFont, setSeriesItemLabelGenerator, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesStroke, setSeriesToolTipGenerator, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setStroke, setToolTipGenerator, setURLGenerator
 
Methods inherited from interface org.jfree.chart.LegendItemSource
getLegendItems
 

Constructor Detail

DeviationRenderer

public DeviationRenderer()
Creates a new renderer that displays lines and shapes for the data items, as well as the shaded area for the y-interval.


DeviationRenderer

public DeviationRenderer(boolean lines,
                         boolean shapes)
Creates a new renderer.

Parameters:
lines - show lines between data items?
shapes - show a shape for each data item?
Method Detail

getAlpha

public float getAlpha()
Returns the alpha transparency for the background shading.

Returns:
The alpha transparency.
See Also:
setAlpha(float)

setAlpha

public void setAlpha(float alpha)
Sets the alpha transparency for the background shading, and sends a RendererChangeEvent to all registered listeners.

Parameters:
alpha - the alpha (in the range 0.0f to 1.0f).
See Also:
getAlpha()

setDrawSeriesLineAsPath

public void setDrawSeriesLineAsPath(boolean flag)
This method is overridden so that this flag cannot be changed---it is set to true for this renderer.

Overrides:
setDrawSeriesLineAsPath in class XYLineAndShapeRenderer
Parameters:
flag - ignored.
See Also:
XYLineAndShapeRenderer.getDrawSeriesLineAsPath()

findRangeBounds

public Range findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.

Specified by:
findRangeBounds in interface XYItemRenderer
Overrides:
findRangeBounds in class AbstractXYItemRenderer
Parameters:
dataset - the dataset (null permitted).
Returns:
The range (null if the dataset is null or empty).
See Also:
AbstractXYItemRenderer.findDomainBounds(XYDataset)

initialise

public XYItemRendererState initialise(java.awt.Graphics2D g2,
                                      java.awt.geom.Rectangle2D dataArea,
                                      XYPlot plot,
                                      XYDataset dataset,
                                      PlotRenderingInfo info)
Initialises and returns a state object that can be passed to each invocation of the drawItem(java.awt.Graphics2D, org.jfree.chart.renderer.xy.XYItemRendererState, java.awt.geom.Rectangle2D, org.jfree.chart.plot.PlotRenderingInfo, org.jfree.chart.plot.XYPlot, org.jfree.chart.axis.ValueAxis, org.jfree.chart.axis.ValueAxis, org.jfree.data.xy.XYDataset, int, int, org.jfree.chart.plot.CrosshairState, int) method.

Specified by:
initialise in interface XYItemRenderer
Overrides:
initialise in class XYLineAndShapeRenderer
Parameters:
g2 - the graphics target.
dataArea - the data area.
plot - the plot.
dataset - the dataset.
info - the plot rendering info.
Returns:
A newly initialised state object.

getPassCount

public int getPassCount()
Returns the number of passes (through the dataset) used by this renderer.

Specified by:
getPassCount in interface XYItemRenderer
Overrides:
getPassCount in class XYLineAndShapeRenderer
Returns:
3.

isItemPass

protected boolean isItemPass(int pass)
Returns true if this is the pass where the shapes are drawn.

Overrides:
isItemPass in class XYLineAndShapeRenderer
Parameters:
pass - the pass index.
Returns:
A boolean.
See Also:
isLinePass(int)

isLinePass

protected boolean isLinePass(int pass)
Returns true if this is the pass where the lines are drawn.

Overrides:
isLinePass in class XYLineAndShapeRenderer
Parameters:
pass - the pass index.
Returns:
A boolean.
See Also:
isItemPass(int)

drawItem

public void drawItem(java.awt.Graphics2D g2,
                     XYItemRendererState state,
                     java.awt.geom.Rectangle2D dataArea,
                     PlotRenderingInfo info,
                     XYPlot plot,
                     ValueAxis domainAxis,
                     ValueAxis rangeAxis,
                     XYDataset dataset,
                     int series,
                     int item,
                     CrosshairState crosshairState,
                     int pass)
Draws the visual representation of a single data item.

Specified by:
drawItem in interface XYItemRenderer
Overrides:
drawItem in class XYLineAndShapeRenderer
Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the area within which the data is being drawn.
info - collects information about the drawing.
plot - the plot (can be used to obtain standard color information etc).
domainAxis - the domain axis.
rangeAxis - the range axis.
dataset - the dataset.
series - the series index (zero-based).
item - the item index (zero-based).
crosshairState - crosshair information for the plot (null permitted).
pass - the pass index.

equals

public boolean equals(java.lang.Object obj)
Tests this renderer for equality with an arbitrary object.

Overrides:
equals in class XYLineAndShapeRenderer
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.