org.jfree.chart.renderer.category

Class BoxAndWhiskerRenderer

public class BoxAndWhiskerRenderer extends AbstractCategoryItemRenderer implements Cloneable, PublicCloneable, 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
Constructor Summary
BoxAndWhiskerRenderer()
Default constructor.
Method Summary
voiddrawHorizontalItem(Graphics2D g2, CategoryItemRendererState state, 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.
voiddrawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass)
Draw a single data item.
voiddrawVerticalItem(Graphics2D g2, CategoryItemRendererState state, 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.
booleanequals(Object obj)
Tests this renderer for equality with an arbitrary object.
RangefindRangeBounds(CategoryDataset dataset)
Returns the range of values from the specified dataset that the renderer will require to display all the data.
PaintgetArtifactPaint()
Returns the paint used to color the median and average markers.
booleangetFillBox()
Returns the flag that controls whether or not the box is filled.
doublegetItemMargin()
Returns the item margin.
LegendItemgetLegendItem(int datasetIndex, int series)
Returns a legend item for a series.
doublegetMaximumBarWidth()
Returns the maximum bar width as a percentage of the available drawing space.
CategoryItemRendererStateinitialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info)
Initialises the renderer.
booleanisMeanVisible()
Returns the flag that controls whether or not the mean indicator is draw for each item.
booleanisMedianVisible()
Returns the flag that controls whether or not the median indicator is draw for each item.
voidsetArtifactPaint(Paint paint)
Sets the paint used to color the median and average markers and sends a RendererChangeEvent to all registered listeners.
voidsetFillBox(boolean flag)
Sets the flag that controls whether or not the box is filled and sends a RendererChangeEvent to all registered listeners.
voidsetItemMargin(double margin)
Sets the item margin and sends a RendererChangeEvent to all registered listeners.
voidsetMaximumBarWidth(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.
voidsetMeanVisible(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.
voidsetMedianVisible(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.

Constructor Detail

BoxAndWhiskerRenderer

public BoxAndWhiskerRenderer()
Default constructor.

Method Detail

drawHorizontalItem

public void drawHorizontalItem(Graphics2D g2, CategoryItemRendererState state, 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).

drawItem

public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass)
Draw a single data item.

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.

drawVerticalItem

public void drawVerticalItem(Graphics2D g2, CategoryItemRendererState state, 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(Object obj)
Tests this renderer for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: true or false.

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.

Parameters: dataset the dataset.

Returns: The range.

getArtifactPaint

public 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

getFillBox

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

Returns: A boolean.

See Also: BoxAndWhiskerRenderer

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: BoxAndWhiskerRenderer

getLegendItem

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

Parameters: datasetIndex the dataset index (zero-based). series the series index (zero-based).

Returns: The legend item (possibly null).

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:

initialise

public CategoryItemRendererState initialise(Graphics2D g2, 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.

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.

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:

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:

setArtifactPaint

public void setArtifactPaint(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

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

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

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:

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:

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:

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