public class BoxAndWhiskerRenderer extends AbstractCategoryItemRenderer implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable
BoxAndWhiskerCategoryDataset and is for use with the
CategoryPlot class. The example shown here is generated
by the BoxAndWhiskerChartDemo1.java program included in the
JFreeChart Demo Collection:

| Modifier and Type | Field and Description |
|---|---|
private java.awt.Paint |
artifactPaint
The color used to paint the median line and average marker.
|
private boolean |
fillBox
A flag that controls whether or not the box is filled.
|
private double |
itemMargin
The margin between items (boxes) within a category.
|
private double |
maximumBarWidth
The maximum bar width as percentage of the available space in the plot.
|
private boolean |
meanVisible
A flag that controls whether or not the mean indicator is drawn.
|
private boolean |
medianVisible
A flag that controls whether or not the median indicator is drawn.
|
private static long |
serialVersionUID
For serialization.
|
private boolean |
useOutlinePaintForWhiskers
A flag that, if
true, causes the whiskers to be drawn
using the outline paint for the series. |
private double |
whiskerWidth
The width of the whiskers as fraction of the bar width.
|
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO| Constructor and Description |
|---|
BoxAndWhiskerRenderer()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
drawEllipse(java.awt.geom.Point2D point,
double oRadius,
java.awt.Graphics2D g2)
Draws a dot to represent an outlier.
|
private void |
drawHighFarOut(double aRadius,
java.awt.Graphics2D g2,
double xx,
double m)
Draws a triangle to indicate the presence of far-out values.
|
void |
drawHorizontalItem(java.awt.Graphics2D g2,
CategoryItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset dataset,
int row,
int column)
Draws the visual representation of a single data item when the plot has
a horizontal orientation.
|
void |
drawItem(java.awt.Graphics2D g2,
CategoryItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset dataset,
int row,
int column,
int pass)
Draw a single data item.
|
private void |
drawLowFarOut(double aRadius,
java.awt.Graphics2D g2,
double xx,
double m)
Draws a triangle to indicate the presence of far-out values.
|
private void |
drawMultipleEllipse(java.awt.geom.Point2D point,
double boxWidth,
double oRadius,
java.awt.Graphics2D g2)
Draws two dots to represent the average value of more than one outlier.
|
void |
drawVerticalItem(java.awt.Graphics2D g2,
CategoryItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset dataset,
int row,
int column)
Draws the visual representation of a single data item when the plot has
a vertical orientation.
|
boolean |
equals(java.lang.Object obj)
Tests this renderer for equality with an arbitrary object.
|
Range |
findRangeBounds(CategoryDataset dataset)
Returns the range of values from the specified dataset that the
renderer will require to display all the data.
|
java.awt.Paint |
getArtifactPaint()
Returns the paint used to color the median and average markers.
|
boolean |
getFillBox()
Returns the flag that controls whether or not the box is filled.
|
double |
getItemMargin()
Returns the item margin.
|
LegendItem |
getLegendItem(int datasetIndex,
int series)
Returns a legend item for a series.
|
double |
getMaximumBarWidth()
Returns the maximum bar width as a percentage of the available drawing
space.
|
boolean |
getUseOutlinePaintForWhiskers()
Returns the flag that, if
true, causes the whiskers to
be drawn using the series outline paint. |
double |
getWhiskerWidth()
Returns the width of the whiskers as fraction of the bar width.
|
CategoryItemRendererState |
initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
int rendererIndex,
PlotRenderingInfo info)
Initialises the renderer.
|
boolean |
isMeanVisible()
Returns the flag that controls whether or not the mean indicator is
draw for each item.
|
boolean |
isMedianVisible()
Returns the flag that controls whether or not the median indicator is
draw for each item.
|
private void |
readObject(java.io.ObjectInputStream stream)
Provides serialization support.
|
void |
setArtifactPaint(java.awt.Paint paint)
Sets the paint used to color the median and average markers 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. |
void |
setItemMargin(double margin)
Sets the item margin and sends a
RendererChangeEvent to all
registered listeners. |
void |
setMaximumBarWidth(double percent)
Sets the maximum bar width, which is specified as a percentage of the
available space for all bars, and sends a
RendererChangeEvent
to all registered listeners. |
void |
setMeanVisible(boolean visible)
Sets the flag that controls whether or not the mean indicator is drawn
for each item, and sends a
RendererChangeEvent to all
registered listeners. |
void |
setMedianVisible(boolean visible)
Sets the flag that controls whether or not the median indicator is drawn
for each item, and sends a
RendererChangeEvent to all
registered listeners. |
void |
setUseOutlinePaintForWhiskers(boolean flag)
Sets the flag that, if
true, causes the whiskers to
be drawn using the series outline paint, and sends a
RendererChangeEvent to all registered listeners. |
void |
setWhiskerWidth(double width)
Sets the width of the whiskers as a fraction of the bar width and sends
a
RendererChangeEvent to all registered listeners. |
private void |
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.
|
addEntity, addItemEntity, calculateDomainMarkerTextAnchorPoint, calculateRangeMarkerTextAnchorPoint, clone, createState, drawBackground, drawDomainGridline, drawDomainMarker, drawItemLabel, drawOutline, drawRangeGridline, drawRangeLine, drawRangeMarker, findRangeBounds, getBaseItemLabelGenerator, getBaseItemURLGenerator, getBaseToolTipGenerator, getColumnCount, getDomainAxis, getDrawingSupplier, getItemLabelGenerator, getItemMiddle, getItemURLGenerator, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPassCount, getPlot, getRangeAxis, getRowCount, getSeriesItemLabelGenerator, getSeriesItemURLGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, hashCode, setBaseItemLabelGenerator, setBaseItemURLGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setItemURLGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesItemURLGenerator, setSeriesToolTipGenerator, setToolTipGenerator, updateCrosshairValuesaddChangeListener, 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, getTreatLegendShapeAsLine, 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, setTreatLegendShapeAsLinefinalize, getClass, notify, notifyAll, toString, wait, wait, waitaddChangeListener, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseStroke, setItemLabelFont, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlineStroke, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesStroke, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setStrokeprivate static final long serialVersionUID
private transient java.awt.Paint artifactPaint
private boolean fillBox
private double itemMargin
private double maximumBarWidth
private boolean medianVisible
private boolean meanVisible
private boolean useOutlinePaintForWhiskers
true, causes the whiskers to be drawn
using the outline paint for the series. The default value is
false and in that case the regular series paint is used.private double whiskerWidth
public java.awt.Paint getArtifactPaint()
null).setArtifactPaint(Paint)public void setArtifactPaint(java.awt.Paint paint)
RendererChangeEvent to all registered listeners.paint - the paint (null not permitted).getArtifactPaint()public boolean getFillBox()
setFillBox(boolean)public void setFillBox(boolean flag)
RendererChangeEvent to all registered listeners.flag - the flag.getFillBox()public double getItemMargin()
setItemMargin(double)public void setItemMargin(double margin)
RendererChangeEvent to all
registered listeners.margin - the margin (a percentage).getItemMargin()public double getMaximumBarWidth()
setMaximumBarWidth(double)public void setMaximumBarWidth(double percent)
RendererChangeEvent
to all registered listeners.percent - the maximum bar width (a percentage, where 0.10 is ten
percent).getMaximumBarWidth()public boolean isMeanVisible()
setMeanVisible(boolean)public void setMeanVisible(boolean visible)
RendererChangeEvent to all
registered listeners.visible - the new flag value.isMeanVisible()public boolean isMedianVisible()
setMedianVisible(boolean)public void setMedianVisible(boolean visible)
RendererChangeEvent to all
registered listeners.visible - the new flag value.isMedianVisible()public boolean getUseOutlinePaintForWhiskers()
true, causes the whiskers to
be drawn using the series outline paint.public void setUseOutlinePaintForWhiskers(boolean flag)
true, causes the whiskers to
be drawn using the series outline paint, and sends a
RendererChangeEvent to all registered listeners.flag - the new flag value.public double getWhiskerWidth()
setWhiskerWidth(double)public void setWhiskerWidth(double width)
RendererChangeEvent to all registered listeners.width - a value between 0 and 1 indicating how wide the
whisker is supposed to be compared to the bar.getWhiskerWidth(),
CategoryItemRendererState.getBarWidth()public LegendItem getLegendItem(int datasetIndex, int series)
getLegendItem in interface CategoryItemRenderergetLegendItem in class AbstractCategoryItemRendererdatasetIndex - the dataset index (zero-based).series - the series index (zero-based).null).AbstractCategoryItemRenderer.getLegendItems()public Range findRangeBounds(CategoryDataset dataset)
findRangeBounds in interface CategoryItemRendererfindRangeBounds in class AbstractCategoryItemRendererdataset - the dataset.public CategoryItemRendererState initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info)
initialise in interface CategoryItemRendererinitialise in class AbstractCategoryItemRendererg2 - the graphics device.dataArea - the area in which the data is to be plotted.plot - the plot.rendererIndex - the renderer index.info - collects chart rendering information for return to caller.public void drawItem(java.awt.Graphics2D g2,
CategoryItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset dataset,
int row,
int column,
int pass)
drawItem in interface CategoryItemRendererg2 - the graphics device.state - the renderer state.dataArea - the area in which the data is drawn.plot - the plot.domainAxis - the domain axis.rangeAxis - the range axis.dataset - the data (must be an instance of
BoxAndWhiskerCategoryDataset).row - the row index (zero-based).column - the column index (zero-based).pass - the pass index.public void drawHorizontalItem(java.awt.Graphics2D g2,
CategoryItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset dataset,
int row,
int column)
g2 - the graphics device.state - the renderer state.dataArea - the area within which the plot is being drawn.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
BoxAndWhiskerCategoryDataset).row - the row index (zero-based).column - the column index (zero-based).public void drawVerticalItem(java.awt.Graphics2D g2,
CategoryItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryDataset dataset,
int row,
int column)
g2 - the graphics device.state - the renderer state.dataArea - the area within which the plot is being drawn.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
BoxAndWhiskerCategoryDataset).row - the row index (zero-based).column - the column index (zero-based).private void drawEllipse(java.awt.geom.Point2D point,
double oRadius,
java.awt.Graphics2D g2)
point - the location.oRadius - the radius.g2 - the graphics device.private void drawMultipleEllipse(java.awt.geom.Point2D point,
double boxWidth,
double oRadius,
java.awt.Graphics2D g2)
point - the locationboxWidth - the box width.oRadius - the radius.g2 - the graphics device.private void drawHighFarOut(double aRadius,
java.awt.Graphics2D g2,
double xx,
double m)
aRadius - the radius.g2 - the graphics device.xx - the x coordinate.m - the y coordinate.private void drawLowFarOut(double aRadius,
java.awt.Graphics2D g2,
double xx,
double m)
aRadius - the radius.g2 - the graphics device.xx - the x coordinate.m - the y coordinate.public boolean equals(java.lang.Object obj)
equals in class AbstractCategoryItemRendererobj - the object (null permitted).true or false.private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
stream - the output stream.java.io.IOException - if there is an I/O error.private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
stream - the input stream.java.io.IOException - if there is an I/O error.java.lang.ClassNotFoundException - if there is a classpath problem.