Package org.jfree.chart.renderer.xy
Class XYErrorRenderer
- java.lang.Object
-
- org.jfree.chart.renderer.AbstractRenderer
-
- org.jfree.chart.renderer.xy.AbstractXYItemRenderer
-
- org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
-
- org.jfree.chart.renderer.xy.XYErrorRenderer
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.EventListener,AnnotationChangeListener,LegendItemSource,XYItemRenderer,PublicCloneable
public class XYErrorRenderer extends XYLineAndShapeRenderer
A line and shape renderer that can also display x and/or y-error values. This renderer expects anIntervalXYDataset, otherwise it reverts to the behaviour of the super class. The example shown here is generated by theXYErrorRendererDemo1.javaprogram included in the JFreeChart demo collection:

- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
XYLineAndShapeRenderer.State
-
-
Field Summary
Fields Modifier and Type Field Description private doublecapLengthThe length of the cap at the end of the error bars.private booleandrawXErrorA flag that controls whether or not the x-error bars are drawn.private booleandrawYErrorA flag that controls whether or not the y-error bars are drawn.private java.awt.PainterrorPaintThe paint used to draw the error bars (ifnullwe use the series paint).private java.awt.StrokeerrorStrokeThe stroke used to draw the error bars (ifnullwe use the series outline stroke).(package private) static longserialVersionUIDFor serialization.-
Fields inherited from class org.jfree.chart.renderer.AbstractRenderer
DEFAULT_ITEM_LABEL_INSETS, 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 Description XYErrorRenderer()Creates a newXYErrorRendererinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 for one data item.booleanequals(java.lang.Object obj)Tests this instance for equality with an arbitrary object.RangefindDomainBounds(XYDataset dataset)Returns the range required by this renderer to display all the domain values in the specified dataset.RangefindRangeBounds(XYDataset dataset)Returns the range required by this renderer to display all the range values in the specified dataset.doublegetCapLength()Returns the length (in Java2D units) of the cap at the end of the error bars.booleangetDrawXError()Returns the flag that controls whether or not the renderer draws error bars for the x-values.booleangetDrawYError()Returns the flag that controls whether or not the renderer draws error bars for the y-values.java.awt.PaintgetErrorPaint()Returns the paint used to draw the error bars.java.awt.StrokegetErrorStroke()Returns the stroke used to draw the error bars.private voidreadObject(java.io.ObjectInputStream stream)Provides serialization support.voidsetCapLength(double length)Sets the length of the cap at the end of the error bars, and sends aRendererChangeEventto all registered listeners.voidsetDrawXError(boolean draw)Sets the flag that controls whether or not the renderer draws error bars for the x-values and, if the flag changes, sends aRendererChangeEventto all registered listeners.voidsetDrawYError(boolean draw)Sets the flag that controls whether or not the renderer draws error bars for the y-values and, if the flag changes, sends aRendererChangeEventto all registered listeners.voidsetErrorPaint(java.awt.Paint paint)Sets the paint used to draw the error bars and sends aRendererChangeEventto all registered listeners.voidsetErrorStroke(java.awt.Stroke stroke)Sets the stroke used to draw the error bars and sends aRendererChangeEventto all registered listeners.private voidwriteObject(java.io.ObjectOutputStream stream)Provides serialization support.-
Methods inherited from class org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
clone, drawFirstPassShape, drawPrimaryLine, drawPrimaryLineAsPath, drawSecondaryPass, getDefaultLinesVisible, getDefaultShapesFilled, getDefaultShapesVisible, getDrawOutlines, getDrawSeriesLineAsPath, getItemLineVisible, getItemShapeFilled, getItemShapeVisible, getLegendItem, getLegendLine, getPassCount, getSeriesLinesVisible, getSeriesShapesFilled, getSeriesShapesVisible, getUseFillPaint, getUseOutlinePaint, hashCode, initialise, isItemPass, isLinePass, setDefaultLinesVisible, setDefaultShapesFilled, setDefaultShapesVisible, setDrawOutlines, setDrawSeriesLineAsPath, setLegendLine, setSeriesLinesVisible, setSeriesLinesVisible, setSeriesShapesFilled, setSeriesShapesFilled, setSeriesShapesVisible, setSeriesShapesVisible, setUseFillPaint, setUseOutlinePaint
-
Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer
addAnnotation, addAnnotation, addEntity, annotationChanged, beginElementGroup, calculateDomainMarkerTextAnchorPoint, drawAnnotations, drawDomainLine, drawDomainMarker, drawItemLabel, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, findRangeBounds, getAnnotations, getDefaultItemLabelGenerator, getDefaultToolTipGenerator, getDrawingSupplier, getItemLabelGenerator, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getURLGenerator, lineTo, moveTo, removeAnnotation, removeAnnotations, setDefaultItemLabelGenerator, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setURLGenerator, updateCrosshairValues
-
Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, beginElementGroup, calculateLabelAnchorPoint, clearSeriesPaints, clearSeriesStrokes, endElementGroup, fireChangeEvent, getAutoPopulateSeriesFillPaint, getAutoPopulateSeriesOutlinePaint, getAutoPopulateSeriesOutlineStroke, getAutoPopulateSeriesPaint, getAutoPopulateSeriesShape, getAutoPopulateSeriesStroke, getDataBoundsIncludesVisibleSeriesOnly, getDefaultCreateEntities, getDefaultEntityRadius, getDefaultFillPaint, getDefaultItemLabelFont, getDefaultItemLabelPaint, getDefaultItemLabelsVisible, getDefaultLegendShape, getDefaultLegendTextFont, getDefaultLegendTextPaint, getDefaultNegativeItemLabelPosition, getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultPositiveItemLabelPosition, getDefaultSeriesVisible, getDefaultSeriesVisibleInLegend, getDefaultShape, getDefaultStroke, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelInsets, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendShape, getLegendTextFont, getLegendTextPaint, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisibleInLegend, getTreatLegendShapeAsLine, hasListener, isComputeItemLabelContrastColor, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, lookupLegendShape, lookupLegendTextFont, lookupLegendTextPaint, lookupSeriesFillPaint, lookupSeriesOutlinePaint, lookupSeriesOutlineStroke, lookupSeriesPaint, lookupSeriesShape, lookupSeriesStroke, notifyListeners, removeChangeListener, setAutoPopulateSeriesFillPaint, setAutoPopulateSeriesOutlinePaint, setAutoPopulateSeriesOutlineStroke, setAutoPopulateSeriesPaint, setAutoPopulateSeriesShape, setAutoPopulateSeriesStroke, setComputeItemLabelContrastColor, setDataBoundsIncludesVisibleSeriesOnly, setDefaultCreateEntities, setDefaultCreateEntities, setDefaultEntityRadius, setDefaultFillPaint, setDefaultFillPaint, setDefaultItemLabelFont, setDefaultItemLabelFont, setDefaultItemLabelPaint, setDefaultItemLabelPaint, setDefaultItemLabelsVisible, setDefaultItemLabelsVisible, setDefaultLegendShape, setDefaultLegendTextFont, setDefaultLegendTextPaint, setDefaultNegativeItemLabelPosition, setDefaultNegativeItemLabelPosition, setDefaultOutlinePaint, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultOutlineStroke, setDefaultPaint, setDefaultPaint, setDefaultPositiveItemLabelPosition, setDefaultPositiveItemLabelPosition, setDefaultSeriesVisible, setDefaultSeriesVisible, setDefaultSeriesVisibleInLegend, setDefaultSeriesVisibleInLegend, setDefaultShape, setDefaultShape, setDefaultStroke, setDefaultStroke, setItemLabelAnchorOffset, setItemLabelInsets, setLegendShape, setLegendTextFont, setLegendTextPaint, 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, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setTreatLegendShapeAsLine
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.chart.LegendItemSource
getLegendItems
-
Methods inherited from interface org.jfree.chart.renderer.xy.XYItemRenderer
addAnnotation, addAnnotation, addChangeListener, drawAnnotations, drawDomainLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, getDefaultCreateEntities, getDefaultFillPaint, getDefaultItemLabelFont, getDefaultItemLabelGenerator, getDefaultItemLabelPaint, getDefaultItemLabelsVisible, getDefaultNegativeItemLabelPosition, getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultPositiveItemLabelPosition, getDefaultSeriesVisible, getDefaultSeriesVisibleInLegend, getDefaultShape, getDefaultStroke, getDefaultToolTipGenerator, getItemCreateEntity, getItemFillPaint, getItemLabelFont, getItemLabelGenerator, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendItemLabelGenerator, getNegativeItemLabelPosition, getPlot, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelGenerator, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesToolTipGenerator, getSeriesVisible, getSeriesVisibleInLegend, getToolTipGenerator, getURLGenerator, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeAnnotation, removeAnnotations, removeChangeListener, setDefaultCreateEntities, setDefaultCreateEntities, setDefaultFillPaint, setDefaultFillPaint, setDefaultItemLabelFont, setDefaultItemLabelGenerator, setDefaultItemLabelPaint, setDefaultItemLabelsVisible, setDefaultItemLabelsVisible, setDefaultNegativeItemLabelPosition, setDefaultNegativeItemLabelPosition, setDefaultOutlinePaint, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultOutlineStroke, setDefaultPaint, setDefaultPaint, setDefaultPositiveItemLabelPosition, setDefaultPositiveItemLabelPosition, setDefaultSeriesVisible, setDefaultSeriesVisible, setDefaultSeriesVisibleInLegend, setDefaultSeriesVisibleInLegend, setDefaultShape, setDefaultShape, setDefaultStroke, setDefaultStroke, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setPlot, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelGenerator, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesToolTipGenerator, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setURLGenerator
-
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
drawXError
private boolean drawXError
A flag that controls whether or not the x-error bars are drawn.
-
drawYError
private boolean drawYError
A flag that controls whether or not the y-error bars are drawn.
-
capLength
private double capLength
The length of the cap at the end of the error bars.
-
errorPaint
private transient java.awt.Paint errorPaint
The paint used to draw the error bars (ifnullwe use the series paint).
-
errorStroke
private transient java.awt.Stroke errorStroke
The stroke used to draw the error bars (ifnullwe use the series outline stroke).
-
-
Method Detail
-
getDrawXError
public boolean getDrawXError()
Returns the flag that controls whether or not the renderer draws error bars for the x-values.- Returns:
- A boolean.
- See Also:
setDrawXError(boolean)
-
setDrawXError
public void setDrawXError(boolean draw)
Sets the flag that controls whether or not the renderer draws error bars for the x-values and, if the flag changes, sends aRendererChangeEventto all registered listeners.- Parameters:
draw- the flag value.- See Also:
getDrawXError()
-
getDrawYError
public boolean getDrawYError()
Returns the flag that controls whether or not the renderer draws error bars for the y-values.- Returns:
- A boolean.
- See Also:
setDrawYError(boolean)
-
setDrawYError
public void setDrawYError(boolean draw)
Sets the flag that controls whether or not the renderer draws error bars for the y-values and, if the flag changes, sends aRendererChangeEventto all registered listeners.- Parameters:
draw- the flag value.- See Also:
getDrawYError()
-
getCapLength
public double getCapLength()
Returns the length (in Java2D units) of the cap at the end of the error bars.- Returns:
- The cap length.
- See Also:
setCapLength(double)
-
setCapLength
public void setCapLength(double length)
Sets the length of the cap at the end of the error bars, and sends aRendererChangeEventto all registered listeners.- Parameters:
length- the length (in Java2D units).- See Also:
getCapLength()
-
getErrorPaint
public java.awt.Paint getErrorPaint()
Returns the paint used to draw the error bars. If this isnull(the default), the item paint is used instead.- Returns:
- The paint (possibly
null). - See Also:
setErrorPaint(Paint)
-
setErrorPaint
public void setErrorPaint(java.awt.Paint paint)
Sets the paint used to draw the error bars and sends aRendererChangeEventto all registered listeners.- Parameters:
paint- the paint (nullpermitted).- See Also:
getErrorPaint()
-
getErrorStroke
public java.awt.Stroke getErrorStroke()
Returns the stroke used to draw the error bars. If this isnull(the default), the item outline stroke is used instead.- Returns:
- The stroke (possibly
null). - See Also:
setErrorStroke(Stroke)
-
setErrorStroke
public void setErrorStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the error bars and sends aRendererChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullpermitted).- See Also:
getErrorStroke()
-
findDomainBounds
public Range findDomainBounds(XYDataset dataset)
Returns the range required by this renderer to display all the domain values in the specified dataset.- Specified by:
findDomainBoundsin interfaceXYItemRenderer- Overrides:
findDomainBoundsin classAbstractXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range, or
nullif the dataset isnull. - See Also:
AbstractXYItemRenderer.findRangeBounds(XYDataset)
-
findRangeBounds
public Range findRangeBounds(XYDataset dataset)
Returns the range required by this renderer to display all the range values in the specified dataset.- Specified by:
findRangeBoundsin interfaceXYItemRenderer- Overrides:
findRangeBoundsin classAbstractXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range, or
nullif the dataset isnull. - 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 for one data item.- Specified by:
drawItemin interfaceXYItemRenderer- Overrides:
drawItemin classXYLineAndShapeRenderer- Parameters:
g2- the graphics output target.state- the renderer state.dataArea- the data area.info- the plot rendering info.plot- the plot.domainAxis- the domain axis.rangeAxis- the range axis.dataset- the dataset.series- the series index.item- the item index.crosshairState- the crosshair state.pass- the pass index.
-
equals
public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equalsin classXYLineAndShapeRenderer- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundExceptionProvides serialization support.- Parameters:
stream- the input stream.- Throws:
java.io.IOException- if there is an I/O error.java.lang.ClassNotFoundException- if there is a classpath problem.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOExceptionProvides serialization support.- Parameters:
stream- the output stream.- Throws:
java.io.IOException- if there is an I/O error.
-
-