org.jfree.chart.renderer.xy

Class DeviationRenderer

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.

Since: 1.0.5

Nested Class Summary
static classDeviationRenderer.State
A state object that is passed to each call to drawItem.
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
voiddrawItem(Graphics2D g2, XYItemRendererState state, 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.
booleanequals(Object obj)
Tests this renderer for equality with an arbitrary object.
RangefindRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.
floatgetAlpha()
Returns the alpha transparency for the background shading.
intgetPassCount()
Returns the number of passes (through the dataset) used by this renderer.
XYItemRendererStateinitialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info)
Initialises and returns a state object that can be passed to each invocation of the DeviationRenderer method.
protected booleanisItemPass(int pass)
Returns true if this is the pass where the shapes are drawn.
protected booleanisLinePass(int pass)
Returns true if this is the pass where the lines are drawn.
voidsetAlpha(float alpha)
Sets the alpha transparency for the background shading, and sends a RendererChangeEvent to all registered listeners.
voidsetDrawSeriesLineAsPath(boolean flag)
This method is overridden so that this flag cannot be changed---it is set to true for this renderer.

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

drawItem

public void drawItem(Graphics2D g2, XYItemRendererState state, 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.

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(Object obj)
Tests this renderer for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

findRangeBounds

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

Parameters: dataset the dataset (null permitted).

Returns: The range (null if the dataset is null or empty).

getAlpha

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

Returns: The alpha transparency.

See Also: DeviationRenderer

getPassCount

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

Returns: 3.

initialise

public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info)
Initialises and returns a state object that can be passed to each invocation of the DeviationRenderer method.

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.

isItemPass

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

Parameters: pass the pass index.

Returns: A boolean.

See Also: DeviationRenderer

isLinePass

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

Parameters: pass the pass index.

Returns: A boolean.

See Also: DeviationRenderer

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.

Parameters: flag ignored.