public class

XYBoxAndWhiskerRenderer

extends AbstractXYItemRenderer
implements Serializable Cloneable XYItemRenderer
java.lang.Object
   ↳ org.jfree.chart.renderer.AbstractRenderer
     ↳ org.jfree.chart.renderer.xy.AbstractXYItemRenderer
       ↳ org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer

Class Overview

A renderer that draws box-and-whisker items on an XYPlot. This renderer requires a BoxAndWhiskerXYDataset). The example shown here is generated by the BoxAndWhiskerChartDemo2.java program included in the JFreeChart demo collection:

XYBoxAndWhiskerRendererSample.png

This renderer does not include any code to calculate the crosshair point.

Summary

[Expand]
Inherited Fields
From class org.jfree.chart.renderer.AbstractRenderer
Public Constructors
XYBoxAndWhiskerRenderer()
Creates a new renderer for box and whisker charts.
XYBoxAndWhiskerRenderer(double boxWidth)
Creates a new renderer for box and whisker charts.
Public Methods
Object clone()
Returns a clone of the renderer.
void drawHorizontalItem(Graphics2D g2, 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.
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.
void drawVerticalItem(Graphics2D g2, 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(Object obj)
Tests this renderer for equality with another object.
Range findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.
Paint getArtifactPaint()
Returns the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse.
Paint getBoxPaint()
Returns the paint used to fill boxes.
double getBoxWidth()
Returns the width of each box.
boolean getFillBox()
Returns the flag that controls whether or not the box is filled.
void setArtifactPaint(Paint paint)
Sets the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse, and sends a RendererChangeEvent to all registered listeners.
void setBoxPaint(Paint paint)
Sets the paint used to fill boxes and sends a RendererChangeEvent to all registered listeners.
void setBoxWidth(double width)
Sets the box width and sends a RendererChangeEvent to all registered listeners.
void setFillBox(boolean flag)
Sets the flag that controls whether or not the box is filled and sends a RendererChangeEvent to all registered listeners.
Protected Methods
void drawEllipse(Point2D point, double oRadius, Graphics2D g2)
Draws an ellipse to represent an outlier.
void drawHighFarOut(double aRadius, Graphics2D g2, double xx, double m)
Draws a triangle to indicate the presence of far out values.
void drawLowFarOut(double aRadius, Graphics2D g2, double xx, double m)
Draws a triangle to indicate the presence of far out values.
void drawMultipleEllipse(Point2D point, double boxWidth, double oRadius, Graphics2D g2)
Draws two ellipses to represent overlapping outliers.
Paint lookupBoxPaint(int series, int item)
Returns the box paint or, if this is null, the item paint.
[Expand]
Inherited Methods
From class org.jfree.chart.renderer.xy.AbstractXYItemRenderer
From class org.jfree.chart.renderer.AbstractRenderer
From class java.lang.Object
From interface org.jfree.chart.LegendItemSource
From interface org.jfree.chart.renderer.xy.XYItemRenderer

Public Constructors

public XYBoxAndWhiskerRenderer ()

Creates a new renderer for box and whisker charts.

public XYBoxAndWhiskerRenderer (double boxWidth)

Creates a new renderer for box and whisker charts.

Use -1 for the box width if you prefer the width to be calculated automatically.

Parameters
boxWidth the box width.

Public Methods

public Object clone ()

Returns a clone of the renderer.

Returns
  • A clone.
Throws
CloneNotSupportedException if the renderer cannot be cloned.

public void drawHorizontalItem (Graphics2D g2, 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.
dataArea the area within which the plot is being drawn.
info collects info 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 (must be an instance of BoxAndWhiskerXYDataset).
series the series index (zero-based).
item the item index (zero-based).
crosshairState crosshair information for the plot (null permitted).
pass the pass index.

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 plot is being drawn.
info collects info 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 (must be an instance of BoxAndWhiskerXYDataset).
series the series index (zero-based).
item the item index (zero-based).
crosshairState crosshair information for the plot (null permitted).
pass the pass index.

public void drawVerticalItem (Graphics2D g2, 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.
dataArea the area within which the plot is being drawn.
info collects info 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 (must be an instance of BoxAndWhiskerXYDataset).
series the series index (zero-based).
item the item index (zero-based).
crosshairState crosshair information for the plot (null permitted).
pass the pass index.

public boolean equals (Object obj)

Tests this renderer for equality with another object.

Parameters
obj the object (null permitted).
Returns
  • true or false.

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).

public Paint getArtifactPaint ()

Returns the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse.

Returns
  • The paint (never null).

public Paint getBoxPaint ()

Returns the paint used to fill boxes.

Returns
  • The paint (possibly null).

public double getBoxWidth ()

Returns the width of each box.

Returns
  • The box width.

public boolean getFillBox ()

Returns the flag that controls whether or not the box is filled.

Returns
  • A boolean.

public void setArtifactPaint (Paint paint)

Sets the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse, and sends a RendererChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setBoxPaint (Paint paint)

Sets the paint used to fill boxes and sends a RendererChangeEvent to all registered listeners.

Parameters
paint the paint (null permitted).
See Also

public void setBoxWidth (double width)

Sets the box width and sends a RendererChangeEvent to all registered listeners.

If you set the width to a negative value, the renderer will calculate the box width automatically based on the space available on the chart.

Parameters
width the width.
See Also

public void setFillBox (boolean flag)

Sets the flag that controls whether or not the box is filled and sends a RendererChangeEvent to all registered listeners.

Parameters
flag the flag.

Protected Methods

protected void drawEllipse (Point2D point, double oRadius, Graphics2D g2)

Draws an ellipse to represent an outlier.

Parameters
point the location.
oRadius the radius.
g2 the graphics device.

protected void drawHighFarOut (double aRadius, Graphics2D g2, double xx, double m)

Draws a triangle to indicate the presence of far out values.

Parameters
aRadius the radius.
g2 the graphics device.
xx the x value.
m the max y value.

protected void drawLowFarOut (double aRadius, Graphics2D g2, double xx, double m)

Draws a triangle to indicate the presence of far out values.

Parameters
aRadius the radius.
g2 the graphics device.
xx the x value.
m the min y value.

protected void drawMultipleEllipse (Point2D point, double boxWidth, double oRadius, Graphics2D g2)

Draws two ellipses to represent overlapping outliers.

Parameters
point the location.
boxWidth the box width.
oRadius the radius.
g2 the graphics device.

protected Paint lookupBoxPaint (int series, int item)

Returns the box paint or, if this is null, the item paint.

Parameters
series the series index.
item the item index.
Returns
  • The paint used to fill the box for the specified item (never null).