Module platform

Class XYErrorRenderer

All Implemented Interfaces:
Serializable, Cloneable, 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 an IntervalXYDataset, otherwise it reverts to the behaviour of the super class. The example shown here is generated by the XYErrorRendererDemo1.java program included in the JFreeChart demo collection:

XYErrorRendererSample.png
See Also:
  • Constructor Details

    • XYErrorRenderer

      public XYErrorRenderer()
      Creates a new XYErrorRenderer instance.
  • Method Details

    • 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

      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 a RendererChangeEvent to all registered listeners.
      Parameters:
      draw - the flag value.
      See Also:
    • 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

      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 a RendererChangeEvent to all registered listeners.
      Parameters:
      draw - the flag value.
      See Also:
    • 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

      public void setCapLength(double length)
      Sets the length of the cap at the end of the error bars, and sends a RendererChangeEvent to all registered listeners.
      Parameters:
      length - the length (in Java2D units).
      See Also:
    • getErrorPaint

      public Paint getErrorPaint()
      Returns the paint used to draw the error bars. If this is null (the default), the item paint is used instead.
      Returns:
      The paint (possibly null).
      See Also:
    • setErrorPaint

      public void setErrorPaint(Paint paint)
      Sets the paint used to draw the error bars and sends a RendererChangeEvent to all registered listeners.
      Parameters:
      paint - the paint (null permitted).
      See Also:
    • getErrorStroke

      public Stroke getErrorStroke()
      Returns the stroke used to draw the error bars. If this is null (the default), the item outline stroke is used instead.
      Returns:
      The stroke (possibly null).
      See Also:
    • setErrorStroke

      public void setErrorStroke(Stroke stroke)
      Sets the stroke used to draw the error bars and sends a RendererChangeEvent to all registered listeners.
      Parameters:
      stroke - the stroke (null permitted).
      See Also:
    • 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:
      findDomainBounds in interface XYItemRenderer
      Overrides:
      findDomainBounds in class AbstractXYItemRenderer
      Parameters:
      dataset - the dataset (null permitted).
      Returns:
      The range, or null if the dataset is null.
      See Also:
    • 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:
      findRangeBounds in interface XYItemRenderer
      Overrides:
      findRangeBounds in class AbstractXYItemRenderer
      Parameters:
      dataset - the dataset (null permitted).
      Returns:
      The range, or null if the dataset is null.
      See Also:
    • drawItem

      public void drawItem(Graphics2D g2, XYItemRendererState state, 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:
      drawItem in interface XYItemRenderer
      Overrides:
      drawItem in class XYLineAndShapeRenderer
      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(Object obj)
      Tests this instance for equality with an arbitrary object.
      Overrides:
      equals in class XYLineAndShapeRenderer
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.