org.jfree.chart.renderer.xy

Class XYBoxAndWhiskerRenderer

Implemented Interfaces:
Cloneable, LegendItemSource, PublicCloneable, Serializable, XYItemRenderer

public class XYBoxAndWhiskerRenderer
extends AbstractXYItemRenderer
implements XYItemRenderer, Cloneable, PublicCloneable, Serializable

A renderer that draws box-and-whisker items on an XYPlot. This renderer requires a BoxAndWhiskerXYDataset).

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

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

XYBoxAndWhiskerRenderer()
Creates a new renderer for box and whisker charts.
XYBoxAndWhiskerRenderer(double boxWidth)
Creates a new renderer for box and whisker charts.

Method Summary

Object
clone()
Returns a clone of the renderer.
protected void
drawEllipse(Point2D point, double oRadius, Graphics2D g2)
Draws an ellipse to represent an outlier.
protected void
drawHighFarOut(double aRadius, Graphics2D g2, double xx, double m)
Draws a triangle to indicate the presence of far out values.
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.
protected void
drawLowFarOut(double aRadius, Graphics2D g2, double xx, double m)
Draws a triangle to indicate the presence of far out values.
protected void
drawMultipleEllipse(Point2D point, double boxWidth, double oRadius, Graphics2D g2)
Draws two ellipses to represent overlapping outliers.
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.
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 artifactPaint)
Sets the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse.
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.

Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer

addAnnotation, addAnnotation, addEntity, calculateDomainMarkerTextAnchorPoint, clone, drawAnnotations, drawDomainGridLine, drawDomainLine, drawDomainMarker, drawItemLabel, drawRangeLine, drawRangeMarker, equals, fillDomainGridBand, fillRangeGridBand, findDomainBounds, findRangeBounds, getBaseItemLabelGenerator, getBaseToolTipGenerator, getDefaultEntityRadius, getDrawingSupplier, getItemLabelGenerator, getItemLabelGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getLegendItems, getPassCount, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, getURLGenerator, initialise, removeAnnotation, removeAnnotations, setBaseItemLabelGenerator, setBaseToolTipGenerator, setDefaultEntityRadius, setItemLabelGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setToolTipGenerator, setURLGenerator, updateCrosshairValues, updateCrosshairValues

Methods inherited from class org.jfree.chart.renderer.AbstractRenderer

addChangeListener, calculateLabelAnchorPoint, clone, equals, fireChangeEvent, getBaseCreateEntities, getBaseFillPaint, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getCreateEntities, getDrawingSupplier, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, hasListener, hashCode, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, notifyListeners, removeChangeListener, setBaseCreateEntities, setBaseCreateEntities, setBaseFillPaint, setBaseFillPaint, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setCreateEntities, setCreateEntities, setFillPaint, setFillPaint, setItemLabelAnchorOffset, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, 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

Constructor Details

XYBoxAndWhiskerRenderer

public XYBoxAndWhiskerRenderer()
Creates a new renderer for box and whisker charts.

XYBoxAndWhiskerRenderer

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.

Method Details

clone

public Object clone()
            throws CloneNotSupportedException
Returns a clone of the renderer.
Overrides:
clone in interface AbstractXYItemRenderer
Returns:
A clone.

drawEllipse

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.

drawHighFarOut

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.

drawHorizontalItem

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.
series - the series index (zero-based).
item - the item index (zero-based).
crosshairState - crosshair information for the plot (null permitted).
pass - the pass index.

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.
Specified by:
drawItem in interface XYItemRenderer
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.
series - the series index (zero-based).
item - the item index (zero-based).
crosshairState - crosshair information for the plot (null permitted).
pass - the pass index.

drawLowFarOut

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.

drawMultipleEllipse

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.

drawVerticalItem

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.
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 another object.
Overrides:
equals in interface AbstractXYItemRenderer
Parameters:
obj - the object (null permitted).
Returns:
true or false.

getArtifactPaint

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

getBoxPaint

public Paint getBoxPaint()
Returns the paint used to fill boxes.
Returns:
The paint (possibly null).

getBoxWidth

public double getBoxWidth()
Returns the width of each box.
Returns:
The box width.

getFillBox

public boolean getFillBox()
Returns the flag that controls whether or not the box is filled.
Returns:
A boolean.

setArtifactPaint

public void setArtifactPaint(Paint artifactPaint)
Sets the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse.
Parameters:
artifactPaint - the paint (null not permitted).

setBoxPaint

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

setBoxWidth

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.

setFillBox

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.