org.jfree.chart.renderer.xy
Class XYBoxAndWhiskerRenderer
- java.lang.Object
-
- org.jfree.chart.renderer.AbstractRenderer
-
- org.jfree.chart.renderer.xy.AbstractXYItemRenderer
-
- org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.EventListener, AnnotationChangeListener, LegendItemSource, XYItemRenderer, org.jfree.util.PublicCloneable
public class XYBoxAndWhiskerRenderer extends AbstractXYItemRenderer implements XYItemRenderer, java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable
A renderer that draws box-and-whisker items on anXYPlot. This renderer requires aBoxAndWhiskerXYDataset). The example shown here is generated by theBoxAndWhiskerChartDemo2.javaprogram included in the JFreeChart demo collection:
This renderer does not include any code to calculate the crosshair point.
- 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
Constructors Constructor and Description XYBoxAndWhiskerRenderer()Creates a new renderer for box and whisker charts.XYBoxAndWhiskerRenderer(double boxWidth)Creates a new renderer for box and whisker charts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectclone()Returns a clone of the renderer.voiddrawHorizontalItem(java.awt.Graphics2D g2, java.awt.geom.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.voiddrawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.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.voiddrawVerticalItem(java.awt.Graphics2D g2, java.awt.geom.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.booleanequals(java.lang.Object obj)Tests this renderer for equality with another object.RangefindRangeBounds(XYDataset dataset)Returns the range of values the renderer requires to display all the items from the specified dataset.java.awt.PaintgetArtifactPaint()Returns the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse.java.awt.PaintgetBoxPaint()Returns the paint used to fill boxes.doublegetBoxWidth()Returns the width of each box.booleangetFillBox()Returns the flag that controls whether or not the box is filled.voidsetArtifactPaint(java.awt.Paint paint)Sets the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse, and sends aRendererChangeEventto all registered listeners.voidsetBoxPaint(java.awt.Paint paint)Sets the paint used to fill boxes and sends aRendererChangeEventto all registered listeners.voidsetBoxWidth(double width)Sets the box width and sends aRendererChangeEventto all registered listeners.voidsetFillBox(boolean flag)Sets the flag that controls whether or not the box is filled and sends aRendererChangeEventto all registered listeners.-
Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer
addAnnotation, addAnnotation, annotationChanged, drawAnnotations, drawDomainGridLine, drawDomainLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, getAnnotations, getBaseItemLabelGenerator, getBaseToolTipGenerator, getDrawingSupplier, getItemLabelGenerator, getItemLabelGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPassCount, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, getURLGenerator, initialise, isPointInRect, removeAnnotation, removeAnnotations, setBaseItemLabelGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setToolTipGenerator, setURLGenerator
-
Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, clearSeriesPaints, clearSeriesStrokes, 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, hashCode, 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
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.chart.renderer.xy.XYItemRenderer
addAnnotation, addAnnotation, addChangeListener, drawAnnotations, drawDomainGridLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, getBaseItemLabelFont, getBaseItemLabelGenerator, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getBaseToolTipGenerator, getItemLabelFont, getItemLabelFont, getItemLabelGenerator, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendItem, getLegendItemLabelGenerator, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPassCount, getPlot, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelGenerator, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesToolTipGenerator, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, getToolTipGenerator, getURLGenerator, initialise, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeAnnotation, removeAnnotations, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelGenerator, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseStroke, setBaseToolTipGenerator, setItemLabelFont, setItemLabelGenerator, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setLegendItemLabelGenerator, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlineStroke, setPaint, setPlot, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesItemLabelFont, setSeriesItemLabelGenerator, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesStroke, setSeriesToolTipGenerator, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setStroke, setToolTipGenerator, setURLGenerator
-
Methods inherited from interface org.jfree.chart.LegendItemSource
getLegendItems
-
-
-
-
Constructor Detail
-
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 Detail
-
getBoxWidth
public double getBoxWidth()
Returns the width of each box.- Returns:
- The box width.
- See Also:
setBoxWidth(double)
-
setBoxWidth
public void setBoxWidth(double width)
Sets the box width and sends aRendererChangeEventto 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:
getBoxWidth()
-
getBoxPaint
public java.awt.Paint getBoxPaint()
Returns the paint used to fill boxes.- Returns:
- The paint (possibly
null). - See Also:
setBoxPaint(Paint)
-
setBoxPaint
public void setBoxPaint(java.awt.Paint paint)
Sets the paint used to fill boxes and sends aRendererChangeEventto all registered listeners.- Parameters:
paint- the paint (nullpermitted).- See Also:
getBoxPaint()
-
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 aRendererChangeEventto all registered listeners.- Parameters:
flag- the flag.- See Also:
setFillBox(boolean)
-
getArtifactPaint
public java.awt.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). - See Also:
setArtifactPaint(Paint)
-
setArtifactPaint
public void setArtifactPaint(java.awt.Paint paint)
Sets the paint used to paint the various artifacts such as outliers, farout symbol, median line and the averages ellipse, and sends aRendererChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getArtifactPaint()
-
findRangeBounds
public Range findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
findRangeBoundsin interfaceXYItemRenderer- Overrides:
findRangeBoundsin classAbstractXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (
nullif the dataset isnullor empty). - See Also:
AbstractXYItemRenderer.findDomainBounds(XYDataset)
-
drawItem
public void drawItem(java.awt.Graphics2D g2, XYItemRendererState state, java.awt.geom.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:
drawItemin interfaceXYItemRenderer- 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 ofBoxAndWhiskerXYDataset).series- the series index (zero-based).item- the item index (zero-based).crosshairState- crosshair information for the plot (nullpermitted).pass- the pass index.
-
drawHorizontalItem
public void drawHorizontalItem(java.awt.Graphics2D g2, java.awt.geom.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 ofBoxAndWhiskerXYDataset).series- the series index (zero-based).item- the item index (zero-based).crosshairState- crosshair information for the plot (nullpermitted).pass- the pass index.
-
drawVerticalItem
public void drawVerticalItem(java.awt.Graphics2D g2, java.awt.geom.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 ofBoxAndWhiskerXYDataset).series- the series index (zero-based).item- the item index (zero-based).crosshairState- crosshair information for the plot (nullpermitted).pass- the pass index.
-
equals
public boolean equals(java.lang.Object obj)
Tests this renderer for equality with another object.- Overrides:
equalsin classAbstractXYItemRenderer- Parameters:
obj- the object (nullpermitted).- Returns:
trueorfalse.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionReturns a clone of the renderer.- Specified by:
clonein interfaceorg.jfree.util.PublicCloneable- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException- if the renderer cannot be cloned.
-
-
DMelt 3.0 © DataMelt by jWork.ORG