Header
And More


org.jfree.chart.renderer.category
Class BoxAndWhiskerRenderer

java.lang.Object
  extended by org.jfree.chart.renderer.AbstractRenderer
      extended by org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
          extended by org.jfree.chart.renderer.category.BoxAndWhiskerRenderer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, LegendItemSource, CategoryItemRenderer, org.jfree.util.PublicCloneable

public class BoxAndWhiskerRenderer
extends AbstractCategoryItemRenderer
implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable

A box-and-whisker renderer. This renderer requires a 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:

BoxAndWhiskerRendererSample.png

See Also:
Serialized Form

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
BoxAndWhiskerRenderer()
          Default constructor.
 
Method Summary
 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.
 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.
 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.
 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.
 
Methods inherited from class org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
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, 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, 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.util.PublicCloneable
clone
 
Methods inherited from interface org.jfree.chart.renderer.category.CategoryItemRenderer
addChangeListener, 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, setStroke
 

Constructor Detail

BoxAndWhiskerRenderer

public BoxAndWhiskerRenderer()
Default constructor.

Method Detail

getArtifactPaint

public java.awt.Paint getArtifactPaint()
Returns the paint used to color the median and average markers.

Returns:
The paint used to draw the median and average markers (never null).
See Also:
setArtifactPaint(Paint)

setArtifactPaint

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

Parameters:
paint - the paint (null not permitted).
See Also:
getArtifactPaint()

getFillBox

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

Returns:
A boolean.
See Also:
setFillBox(boolean)

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.
See Also:
getFillBox()

getItemMargin

public double getItemMargin()
Returns the item margin. This is a percentage of the available space that is allocated to the space between items in the chart.

Returns:
The margin.
See Also:
setItemMargin(double)

setItemMargin

public void setItemMargin(double margin)
Sets the item margin and sends a RendererChangeEvent to all registered listeners.

Parameters:
margin - the margin (a percentage).
See Also:
getItemMargin()

getMaximumBarWidth

public double getMaximumBarWidth()
Returns the maximum bar width as a percentage of the available drawing space.

Returns:
The maximum bar width.
Since:
1.0.10
See Also:
setMaximumBarWidth(double)

setMaximumBarWidth

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

Parameters:
percent - the maximum Bar Width (a percentage).
Since:
1.0.10
See Also:
getMaximumBarWidth()

isMeanVisible

public boolean isMeanVisible()
Returns the flag that controls whether or not the mean indicator is draw for each item.

Returns:
A boolean.
Since:
1.0.13
See Also:
setMeanVisible(boolean)

setMeanVisible

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

Parameters:
visible - the new flag value.
Since:
1.0.13
See Also:
isMeanVisible()

isMedianVisible

public boolean isMedianVisible()
Returns the flag that controls whether or not the median indicator is draw for each item.

Returns:
A boolean.
Since:
1.0.13
See Also:
setMedianVisible(boolean)

setMedianVisible

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

Parameters:
visible - the new flag value.
Since:
1.0.13
See Also:
isMedianVisible()

getLegendItem

public LegendItem getLegendItem(int datasetIndex,
                                int series)
Returns a legend item for a series.

Specified by:
getLegendItem in interface CategoryItemRenderer
Overrides:
getLegendItem in class AbstractCategoryItemRenderer
Parameters:
datasetIndex - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
The legend item (possibly null).
See Also:
AbstractCategoryItemRenderer.getLegendItems()

findRangeBounds

public Range findRangeBounds(CategoryDataset dataset)
Returns the range of values from the specified dataset that the renderer will require to display all the data.

Specified by:
findRangeBounds in interface CategoryItemRenderer
Overrides:
findRangeBounds in class AbstractCategoryItemRenderer
Parameters:
dataset - the dataset.
Returns:
The range.

initialise

public CategoryItemRendererState initialise(java.awt.Graphics2D g2,
                                            java.awt.geom.Rectangle2D dataArea,
                                            CategoryPlot plot,
                                            int rendererIndex,
                                            PlotRenderingInfo info)
Initialises the renderer. This method gets called once at the start of the process of drawing a chart.

Specified by:
initialise in interface CategoryItemRenderer
Overrides:
initialise in class AbstractCategoryItemRenderer
Parameters:
g2 - 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.
Returns:
The renderer state.

drawItem

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)
Draw a single data item.

Specified by:
drawItem in interface CategoryItemRenderer
Parameters:
g2 - 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.

drawHorizontalItem

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)
Draws the visual representation of a single data item when the plot has a horizontal orientation.

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

drawVerticalItem

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)
Draws the visual representation of a single data item when the plot has a vertical orientation.

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

equals

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

Overrides:
equals in class AbstractCategoryItemRenderer
Parameters:
obj - the object (null permitted).
Returns:
true or false.

Footer
And More


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