Class AbstractXYItemRenderer

java.lang.Object
org.jfree.chart.renderer.AbstractRenderer
org.jfree.chart.renderer.AbstractXYItemRenderer
All Implemented Interfaces:
Serializable, Cloneable, XYItemRenderer
Direct Known Subclasses:
AreaXYRenderer, CandlestickRenderer, HighLowRenderer, SignalRenderer, StandardXYItemRenderer, WindItemRenderer, XYAreaRenderer, XYAreaRenderer2, XYBarRenderer, XYBoxAndWhiskerRenderer, XYBubbleRenderer, XYDifferenceRenderer, XYDotRenderer, XYLineAndShapeRenderer, XYStepAreaRenderer, XYStepRenderer, YIntervalRenderer

public abstract class AbstractXYItemRenderer
extends AbstractRenderer
implements XYItemRenderer, Cloneable, Serializable
A base class that can be used to create new XYItemRenderer implementations.
See Also:
Serialized Form
  • Method Details

    • getPassCount

      public int getPassCount()
      Returns the number of passes through the data that the renderer requires in order to draw the chart. Most charts will require a single pass, but some require two passes.
      Specified by:
      getPassCount in interface XYItemRenderer
      Returns:
      The pass count.
    • getPlot

      public XYPlot getPlot()
      Returns the plot that the renderer is assigned to.
      Specified by:
      getPlot in interface XYItemRenderer
      Returns:
      The plot.
    • setPlot

      public void setPlot​(XYPlot plot)
      Sets the plot that the renderer is assigned to.
      Specified by:
      setPlot in interface XYItemRenderer
      Parameters:
      plot - the plot.
    • initialise

      public XYItemRendererState initialise​(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info)
      Initialises the renderer and returns a state object that should be passed to all subsequent calls to the drawItem() method.

      This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses.

      Specified by:
      initialise in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      dataArea - the area inside the axes.
      plot - the plot.
      data - the data.
      info - an optional info collection object to return data back to the caller.
      Returns:
      the renderer state (never null).
    • getLabelGenerator

      public XYLabelGenerator getLabelGenerator​(int row, int column)
      Returns the label generator for a data item. This implementation simply passes control to the getSeriesLabelGenerator(int) method. If, for some reason, you want a different generator for individual items, you can override this method.
      Specified by:
      getLabelGenerator in interface XYItemRenderer
      Parameters:
      row - the row index (zero based).
      column - the column index (zero based).
      Returns:
      the generator (possibly null).
    • getSeriesLabelGenerator

      public XYLabelGenerator getSeriesLabelGenerator​(int series)
      Returns the label generator for a series.
      Specified by:
      getSeriesLabelGenerator in interface XYItemRenderer
      Parameters:
      series - the series index (zero based).
      Returns:
      the generator (possibly null).
    • setLabelGenerator

      public void setLabelGenerator​(XYLabelGenerator generator)
      Sets the item label generator for ALL series and sends a RendererChangeEvent to all registered listeners.
      Specified by:
      setLabelGenerator in interface XYItemRenderer
      Parameters:
      generator - the generator (null permitted).
    • setSeriesLabelGenerator

      public void setSeriesLabelGenerator​(int series, XYLabelGenerator generator)
      Sets the label generator for a series and sends a RendererChangeEvent to all registered listeners.
      Specified by:
      setSeriesLabelGenerator in interface XYItemRenderer
      Parameters:
      series - the series index (zero based).
      generator - the generator (null permitted).
    • getBaseLabelGenerator

      public XYLabelGenerator getBaseLabelGenerator()
      Returns the base item label generator.
      Specified by:
      getBaseLabelGenerator in interface XYItemRenderer
      Returns:
      the generator (possibly null).
    • setBaseLabelGenerator

      public void setBaseLabelGenerator​(XYLabelGenerator generator)
      Sets the base item label generator and sends a RendererChangeEvent to all registered listeners.
      Specified by:
      setBaseLabelGenerator in interface XYItemRenderer
      Parameters:
      generator - the generator (null permitted).
    • getToolTipGenerator

      public XYToolTipGenerator getToolTipGenerator​(int row, int column)
      Returns the tool tip generator for a data item. This implementation simply passes control to the getSeriesToolTipGenerator() method. If, for some reason, you want a different generator for individual items, you can override this method.
      Specified by:
      getToolTipGenerator in interface XYItemRenderer
      Parameters:
      row - the row index (zero based).
      column - the column index (zero based).
      Returns:
      The generator (possibly null).
    • getSeriesToolTipGenerator

      public XYToolTipGenerator getSeriesToolTipGenerator​(int series)
      Returns the tool tip generator for a series.
      Specified by:
      getSeriesToolTipGenerator in interface XYItemRenderer
      Parameters:
      series - the series index (zero based).
      Returns:
      The generator (possibly null).
    • setToolTipGenerator

      public void setToolTipGenerator​(XYToolTipGenerator generator)
      Sets the tool tip generator for ALL series and sends a RendererChangeEvent to all registered listeners.
      Specified by:
      setToolTipGenerator in interface XYItemRenderer
      Parameters:
      generator - the generator (null permitted).
    • setSeriesToolTipGenerator

      public void setSeriesToolTipGenerator​(int series, XYToolTipGenerator generator)
      Sets the tool tip generator for a series and sends a RendererChangeEvent to all registered listeners.
      Specified by:
      setSeriesToolTipGenerator in interface XYItemRenderer
      Parameters:
      series - the series index (zero based).
      generator - the generator (null permitted).
    • getBaseToolTipGenerator

      public XYToolTipGenerator getBaseToolTipGenerator()
      Returns the base tool tip generator.
      Specified by:
      getBaseToolTipGenerator in interface XYItemRenderer
      Returns:
      The generator (possibly null).
    • setBaseToolTipGenerator

      public void setBaseToolTipGenerator​(XYToolTipGenerator generator)
      Sets the base tool tip generator and sends a RendererChangeEvent to all registered listeners.
      Specified by:
      setBaseToolTipGenerator in interface XYItemRenderer
      Parameters:
      generator - the generator (null permitted).
    • getURLGenerator

      public XYURLGenerator getURLGenerator()
      Returns the URL generator for HTML image maps.
      Specified by:
      getURLGenerator in interface XYItemRenderer
      Returns:
      the URL generator (possibly null).
    • setURLGenerator

      public void setURLGenerator​(XYURLGenerator urlGenerator)
      Sets the URL generator for HTML image maps.
      Specified by:
      setURLGenerator in interface XYItemRenderer
      Parameters:
      urlGenerator - the URL generator (null permitted).
    • getRangeType

      public RangeType getRangeType()
      Returns the range type for the renderer.

      The default implementation returns STANDARD, subclasses may override this behaviour.

      The XYPlot uses this information when auto-calculating the range for the axis.

      Specified by:
      getRangeType in interface XYItemRenderer
      Returns:
      the range type.
    • getRangeExtent

      public Range getRangeExtent​(XYDataset dataset)
      Returns the range of values the renderer requires to display all the items from the specified dataset.
      Specified by:
      getRangeExtent in interface XYItemRenderer
      Parameters:
      dataset - the dataset (null permitted).
      Returns:
      The range (or null if the dataset is null or empty).
    • getLegendItem

      public LegendItem getLegendItem​(int datasetIndex, int series)
      Returns a legend item for a series.
      Specified by:
      getLegendItem in interface XYItemRenderer
      Parameters:
      datasetIndex - the dataset index (zero-based).
      series - the series index (zero-based).
      Returns:
      a legend item for the series.
    • fillDomainGridBand

      public void fillDomainGridBand​(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double start, double end)
      Fills a band between two values on the axis. This can be used to color bands between the grid lines.
      Specified by:
      fillDomainGridBand in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      axis - the domain axis.
      dataArea - the data area.
      start - the start value.
      end - the end value.
    • fillRangeGridBand

      public void fillRangeGridBand​(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double start, double end)
      Fills a band between two values on the range axis. This can be used to color bands between the grid lines.
      Specified by:
      fillRangeGridBand in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      axis - the range axis.
      dataArea - the data area.
      start - the start value.
      end - the end value.
    • drawDomainGridLine

      public void drawDomainGridLine​(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value)
      Draws a grid line against the range axis.
      Specified by:
      drawDomainGridLine in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      axis - the value axis.
      dataArea - the area for plotting data (not yet adjusted for any 3D effect).
      value - the value at which the grid line should be drawn.
    • drawRangeGridLine

      public void drawRangeGridLine​(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value)
      Draws a grid line against the range axis.
      Specified by:
      drawRangeGridLine in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      axis - the value axis.
      dataArea - the area for plotting data (not yet adjusted for any 3D effect).
      value - the value at which the grid line should be drawn.
    • drawDomainMarker

      public void drawDomainMarker​(Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, Rectangle2D dataArea)
      Draws a vertical line on the chart to represent a 'range marker'.
      Specified by:
      drawDomainMarker in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      domainAxis - the domain axis.
      marker - the marker line.
      dataArea - the axis data area.
    • drawRangeMarker

      public void drawRangeMarker​(Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea)
      Draws a horizontal line across the chart to represent a 'range marker'.
      Specified by:
      drawRangeMarker in interface XYItemRenderer
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      rangeAxis - the range axis.
      marker - the marker line.
      dataArea - the axis data area.
    • equals

      public boolean equals​(Object obj)
      Tests this renderer for equality with another object.
      Overrides:
      equals in class AbstractRenderer
      Parameters:
      obj - the object.
      Returns:
      true or false.
    • getDrawingSupplier

      public DrawingSupplier getDrawingSupplier()
      Returns the drawing supplier from the plot.
      Specified by:
      getDrawingSupplier in class AbstractRenderer
      Returns:
      The drawing supplier (possibly null).