Package org.jfree.chart.renderer
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
-
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 -
Method Summary
Modifier and Type Method Description voiddrawDomainGridLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value)Draws a grid line against the range axis.voiddrawDomainMarker(Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, Rectangle2D dataArea)Draws a vertical line on the chart to represent a 'range marker'.voiddrawRangeGridLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value)Draws a grid line against the range axis.voiddrawRangeMarker(Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea)Draws a horizontal line across the chart to represent a 'range marker'.booleanequals(Object obj)Tests this renderer for equality with another object.voidfillDomainGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double start, double end)Fills a band between two values on the axis.voidfillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double start, double end)Fills a band between two values on the range axis.XYLabelGeneratorgetBaseLabelGenerator()Returns the base item label generator.XYToolTipGeneratorgetBaseToolTipGenerator()Returns the base tool tip generator.DrawingSuppliergetDrawingSupplier()Returns the drawing supplier from the plot.XYLabelGeneratorgetLabelGenerator(int row, int column)Returns the label generator for a data item.LegendItemgetLegendItem(int datasetIndex, int series)Returns a legend item for a series.intgetPassCount()Returns the number of passes through the data that the renderer requires in order to draw the chart.XYPlotgetPlot()Returns the plot that the renderer is assigned to.RangegetRangeExtent(XYDataset dataset)Returns the range of values the renderer requires to display all the items from the specified dataset.RangeTypegetRangeType()Returns the range type for the renderer.XYLabelGeneratorgetSeriesLabelGenerator(int series)Returns the label generator for a series.XYToolTipGeneratorgetSeriesToolTipGenerator(int series)Returns the tool tip generator for a series.XYToolTipGeneratorgetToolTipGenerator(int row, int column)Returns the tool tip generator for a data item.XYURLGeneratorgetURLGenerator()Returns the URL generator for HTML image maps.XYItemRendererStateinitialise(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.voidsetBaseLabelGenerator(XYLabelGenerator generator)Sets the base item label generator and sends aRendererChangeEventto all registered listeners.voidsetBaseToolTipGenerator(XYToolTipGenerator generator)Sets the base tool tip generator and sends aRendererChangeEventto all registered listeners.voidsetLabelGenerator(XYLabelGenerator generator)Sets the item label generator for ALL series and sends aRendererChangeEventto all registered listeners.voidsetPlot(XYPlot plot)Sets the plot that the renderer is assigned to.voidsetSeriesLabelGenerator(int series, XYLabelGenerator generator)Sets the label generator for a series and sends aRendererChangeEventto all registered listeners.voidsetSeriesToolTipGenerator(int series, XYToolTipGenerator generator)Sets the tool tip generator for a series and sends aRendererChangeEventto all registered listeners.voidsetToolTipGenerator(XYToolTipGenerator generator)Sets the tool tip generator for ALL series and sends aRendererChangeEventto all registered listeners.voidsetURLGenerator(XYURLGenerator urlGenerator)Sets the URL generator for HTML image maps.Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, getBaseItemLabelAnchor, getBaseItemLabelAngle, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelRotationAnchor, getBaseItemLabelsVisible, getBaseItemLabelTextAnchor, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseShape, getBaseStroke, getItemLabelAnchor, getItemLabelAnchorOffset, getItemLabelAngle, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemLabelRotationAnchor, getItemLabelTextAnchor, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelAnchor, getSeriesItemLabelAngle, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesItemLabelRotationAnchor, getSeriesItemLabelTextAnchor, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, hashCode, isItemLabelVisible, isSeriesItemLabelsVisible, notifyListeners, removeChangeListener, setBaseAngle, setBaseItemLabelAnchor, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelRotationAnchor, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelTextAnchor, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setItemLabelAnchor, setItemLabelAnchorOffset, setItemLabelAngle, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelRotationAnchor, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setItemLabelTextAnchor, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlinePaint, setOutlineStroke, setOutlineStroke, setPaint, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesAngle, setSeriesItemLabelAnchor, setSeriesItemLabelFont, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelPaint, setSeriesItemLabelRotationAnchor, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelTextAnchor, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setShape, setShape, setStroke, setStrokeMethods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.chart.renderer.XYItemRenderer
addChangeListener, drawItem, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseShape, getBaseStroke, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, isItemLabelVisible, isSeriesItemLabelsVisible, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseShape, setBaseStroke, setItemLabelFont, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlineStroke, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesStroke, setShape, setStroke
-
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:
getPassCountin interfaceXYItemRenderer- Returns:
- The pass count.
-
getPlot
Returns the plot that the renderer is assigned to.- Specified by:
getPlotin interfaceXYItemRenderer- Returns:
- The plot.
-
setPlot
Sets the plot that the renderer is assigned to.- Specified by:
setPlotin interfaceXYItemRenderer- 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:
initialisein interfaceXYItemRenderer- 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
Returns the label generator for a data item. This implementation simply passes control to thegetSeriesLabelGenerator(int)method. If, for some reason, you want a different generator for individual items, you can override this method.- Specified by:
getLabelGeneratorin interfaceXYItemRenderer- Parameters:
row- the row index (zero based).column- the column index (zero based).- Returns:
- the generator (possibly
null).
-
getSeriesLabelGenerator
Returns the label generator for a series.- Specified by:
getSeriesLabelGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).- Returns:
- the generator (possibly
null).
-
setLabelGenerator
Sets the item label generator for ALL series and sends aRendererChangeEventto all registered listeners.- Specified by:
setLabelGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullpermitted).
-
setSeriesLabelGenerator
Sets the label generator for a series and sends aRendererChangeEventto all registered listeners.- Specified by:
setSeriesLabelGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).generator- the generator (nullpermitted).
-
getBaseLabelGenerator
Returns the base item label generator.- Specified by:
getBaseLabelGeneratorin interfaceXYItemRenderer- Returns:
- the generator (possibly
null).
-
setBaseLabelGenerator
Sets the base item label generator and sends aRendererChangeEventto all registered listeners.- Specified by:
setBaseLabelGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullpermitted).
-
getToolTipGenerator
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:
getToolTipGeneratorin interfaceXYItemRenderer- Parameters:
row- the row index (zero based).column- the column index (zero based).- Returns:
- The generator (possibly
null).
-
getSeriesToolTipGenerator
Returns the tool tip generator for a series.- Specified by:
getSeriesToolTipGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).- Returns:
- The generator (possibly
null).
-
setToolTipGenerator
Sets the tool tip generator for ALL series and sends aRendererChangeEventto all registered listeners.- Specified by:
setToolTipGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullpermitted).
-
setSeriesToolTipGenerator
Sets the tool tip generator for a series and sends aRendererChangeEventto all registered listeners.- Specified by:
setSeriesToolTipGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).generator- the generator (nullpermitted).
-
getBaseToolTipGenerator
Returns the base tool tip generator.- Specified by:
getBaseToolTipGeneratorin interfaceXYItemRenderer- Returns:
- The generator (possibly
null).
-
setBaseToolTipGenerator
Sets the base tool tip generator and sends aRendererChangeEventto all registered listeners.- Specified by:
setBaseToolTipGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullpermitted).
-
getURLGenerator
Returns the URL generator for HTML image maps.- Specified by:
getURLGeneratorin interfaceXYItemRenderer- Returns:
- the URL generator (possibly
null).
-
setURLGenerator
Sets the URL generator for HTML image maps.- Specified by:
setURLGeneratorin interfaceXYItemRenderer- Parameters:
urlGenerator- the URL generator (nullpermitted).
-
getRangeType
Returns the range type for the renderer.The default implementation returns
STANDARD, subclasses may override this behaviour.The
XYPlotuses this information when auto-calculating the range for the axis.- Specified by:
getRangeTypein interfaceXYItemRenderer- Returns:
- the range type.
-
getRangeExtent
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
getRangeExtentin interfaceXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (or
nullif the dataset isnullor empty).
-
getLegendItem
Returns a legend item for a series.- Specified by:
getLegendItemin interfaceXYItemRenderer- 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:
fillDomainGridBandin interfaceXYItemRenderer- 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:
fillRangeGridBandin interfaceXYItemRenderer- 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:
drawDomainGridLinein interfaceXYItemRenderer- 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:
drawRangeGridLinein interfaceXYItemRenderer- 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:
drawDomainMarkerin interfaceXYItemRenderer- 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:
drawRangeMarkerin interfaceXYItemRenderer- Parameters:
g2- the graphics device.plot- the plot.rangeAxis- the range axis.marker- the marker line.dataArea- the axis data area.
-
equals
Tests this renderer for equality with another object.- Overrides:
equalsin classAbstractRenderer- Parameters:
obj- the object.- Returns:
trueorfalse.
-
getDrawingSupplier
Returns the drawing supplier from the plot.- Specified by:
getDrawingSupplierin classAbstractRenderer- Returns:
- The drawing supplier (possibly
null).
-