Package org.jfree.chart.renderer.xy
Class AbstractXYItemRenderer
- java.lang.Object
-
- org.jfree.chart.renderer.AbstractRenderer
-
- org.jfree.chart.renderer.xy.AbstractXYItemRenderer
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,AnnotationChangeListener
,LegendItemSource
,XYItemRenderer
- Direct Known Subclasses:
CandlestickRenderer
,HighLowRenderer
,SamplingXYLineRenderer
,StandardXYItemRenderer
,VectorRenderer
,WindItemRenderer
,XYAreaRenderer
,XYAreaRenderer2
,XYBarRenderer
,XYBlockRenderer
,XYBoxAndWhiskerRenderer
,XYBubbleRenderer
,XYDifferenceRenderer
,XYDotRenderer
,XYLineAndShapeRenderer
,XYShapeRenderer
,XYStepAreaRenderer
,YIntervalRenderer
public abstract class AbstractXYItemRenderer extends AbstractRenderer implements XYItemRenderer, AnnotationChangeListener, java.lang.Cloneable, java.io.Serializable
A base class that can be used to create newXYItemRenderer
implementations.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List
backgroundAnnotations
Annotations to be drawn in the background layer ('underneath' the data items).private XYItemLabelGenerator
defaultItemLabelGenerator
The default item label generator.private XYToolTipGenerator
defaultToolTipGenerator
The default tool tip generator.private java.util.List
foregroundAnnotations
Annotations to be drawn in the foreground layer ('on top' of the data items).private java.util.Map<java.lang.Integer,XYItemLabelGenerator>
itemLabelGeneratorMap
A list of item label generators (one per series).private XYSeriesLabelGenerator
legendItemLabelGenerator
The legend item label generator.private XYSeriesLabelGenerator
legendItemToolTipGenerator
The legend item tool tip generator.private XYSeriesLabelGenerator
legendItemURLGenerator
The legend item URL generator.private XYPlot
plot
The plot.private static long
serialVersionUID
For serialization.private java.util.Map<java.lang.Integer,XYToolTipGenerator>
toolTipGeneratorMap
A list of tool tip generators (one per series).private XYURLGenerator
urlGenerator
The URL text generator.-
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 Modifier Constructor Description protected
AbstractXYItemRenderer()
Creates a renderer where the tooltip generator and the URL generator are bothnull
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(XYAnnotation annotation)
Adds an annotation and sends aRendererChangeEvent
to all registered listeners.void
addAnnotation(XYAnnotation annotation, Layer layer)
Adds an annotation to the specified layer and sends aRendererChangeEvent
to all registered listeners.protected void
addEntity(EntityCollection entities, java.awt.Shape hotspot, XYDataset dataset, int series, int item, double entityX, double entityY)
Adds an entity to the collection.void
annotationChanged(AnnotationChangeEvent event)
Receives notification of a change to anAnnotation
added to this renderer.protected void
beginElementGroup(java.awt.Graphics2D g2, java.lang.Comparable seriesKey, int itemIndex)
Adds aKEY_BEGIN_ELEMENT
hint to the graphics target.protected java.awt.geom.Point2D
calculateDomainMarkerTextAnchorPoint(java.awt.Graphics2D g2, PlotOrientation orientation, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetType, RectangleAnchor anchor)
Calculates the(x, y)
coordinates for drawing a marker label.private java.awt.geom.Point2D
calculateRangeMarkerTextAnchorPoint(java.awt.Graphics2D g2, PlotOrientation orientation, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetForRange, RectangleAnchor anchor)
Calculates the (x, y) coordinates for drawing a marker label.protected java.lang.Object
clone()
Returns a clone of the renderer.void
drawAnnotations(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer, PlotRenderingInfo info)
Draws all the annotations for the specified layer.void
drawDomainLine(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Paint paint, java.awt.Stroke stroke)
Draws a line perpendicular to the domain axis.void
drawDomainMarker(java.awt.Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, java.awt.geom.Rectangle2D dataArea)
Draws a line on the chart perpendicular to the x-axis to mark a value or range of values.protected void
drawItemLabel(java.awt.Graphics2D g2, PlotOrientation orientation, XYDataset dataset, int series, int item, double x, double y, boolean negative)
Draws an item label.void
drawRangeLine(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Paint paint, java.awt.Stroke stroke)
Draws a line perpendicular to the range axis.void
drawRangeMarker(java.awt.Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, java.awt.geom.Rectangle2D dataArea)
Draws a line on the chart perpendicular to the y-axis to mark a value or range of values.boolean
equals(java.lang.Object obj)
Tests this renderer for equality with another object.void
fillDomainGridBand(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double start, double end)
Fills a band between two values on the axis.void
fillRangeGridBand(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double start, double end)
Fills a band between two values on the range axis.Range
findDomainBounds(XYDataset dataset)
Returns the lower and upper bounds (range) of the x-values in the specified dataset.protected Range
findDomainBounds(XYDataset dataset, boolean includeInterval)
Returns the lower and upper bounds (range) of the x-values in the specified dataset.Range
findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.protected Range
findRangeBounds(XYDataset dataset, boolean includeInterval)
Returns the range of values the renderer requires to display all the items from the specified dataset.java.util.Collection
getAnnotations()
Returns a collection of the annotations that are assigned to the renderer.XYItemLabelGenerator
getDefaultItemLabelGenerator()
Returns the default item label generator.XYToolTipGenerator
getDefaultToolTipGenerator()
Returns the default tool tip generator.DrawingSupplier
getDrawingSupplier()
Returns the drawing supplier from the plot.XYItemLabelGenerator
getItemLabelGenerator(int series, int item)
Returns the label generator for a data item.LegendItem
getLegendItem(int datasetIndex, int series)
Returns a default legend item for the specified series.XYSeriesLabelGenerator
getLegendItemLabelGenerator()
Returns the legend item label generator.LegendItemCollection
getLegendItems()
Returns a (possibly empty) collection of legend items for the series that this renderer is responsible for drawing.XYSeriesLabelGenerator
getLegendItemToolTipGenerator()
Returns the legend item tool tip generator.XYSeriesLabelGenerator
getLegendItemURLGenerator()
Returns the legend item URL generator.int
getPassCount()
Returns the number of passes through the data that the renderer requires in order to draw the chart.XYPlot
getPlot()
Returns the plot that the renderer is assigned to.XYItemLabelGenerator
getSeriesItemLabelGenerator(int series)
Returns the item label generator for a series.XYToolTipGenerator
getSeriesToolTipGenerator(int series)
Returns the tool tip generator for a series.XYToolTipGenerator
getToolTipGenerator(int series, int item)
Returns the tool tip generator for a data item.XYURLGenerator
getURLGenerator()
Returns the URL generator for HTML image maps.int
hashCode()
Returns a hashcode for the renderer.XYItemRendererState
initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info)
Initialises the renderer and returns a state object that should be passed to all subsequent calls to the drawItem() method.protected static void
lineTo(java.awt.geom.GeneralPath hotspot, double x, double y)
Utility method delegating toPath2D.Float.lineTo(double, double)
taking double as parameters.protected static void
moveTo(java.awt.geom.GeneralPath hotspot, double x, double y)
Utility method delegating toPath2D.Float.moveTo(double, double)
taking double as parameters.boolean
removeAnnotation(XYAnnotation annotation)
Removes the specified annotation and sends aRendererChangeEvent
to all registered listeners.void
removeAnnotations()
Removes all annotations and sends aRendererChangeEvent
to all registered listeners.void
setDefaultItemLabelGenerator(XYItemLabelGenerator generator)
Sets the default item label generator and sends aRendererChangeEvent
to all registered listeners.void
setDefaultToolTipGenerator(XYToolTipGenerator generator)
Sets the default tool tip generator and sends aRendererChangeEvent
to all registered listeners.void
setLegendItemLabelGenerator(XYSeriesLabelGenerator generator)
Sets the legend item label generator and sends aRendererChangeEvent
to all registered listeners.void
setLegendItemToolTipGenerator(XYSeriesLabelGenerator generator)
Sets the legend item tool tip generator and sends aRendererChangeEvent
to all registered listeners.void
setLegendItemURLGenerator(XYSeriesLabelGenerator generator)
Sets the legend item URL generator and sends aRendererChangeEvent
to all registered listeners.void
setPlot(XYPlot plot)
Sets the plot that the renderer is assigned to.void
setSeriesItemLabelGenerator(int series, XYItemLabelGenerator generator)
Sets the item label generator for a series and sends aRendererChangeEvent
to all registered listeners.void
setSeriesToolTipGenerator(int series, XYToolTipGenerator generator)
Sets the tool tip generator for a series and sends aRendererChangeEvent
to all registered listeners.void
setURLGenerator(XYURLGenerator urlGenerator)
Sets the URL generator for HTML image maps and sends aRendererChangeEvent
to all registered listeners.protected void
updateCrosshairValues(CrosshairState crosshairState, double x, double y, int datasetIndex, double transX, double transY, PlotOrientation orientation)
Considers the current (x, y) coordinate and updates the crosshair point if it meets the criteria (usually means the (x, y) coordinate is the closest to the anchor point so far).-
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.renderer.xy.XYItemRenderer
addChangeListener, drawItem, getDefaultCreateEntities, getDefaultFillPaint, getDefaultItemLabelFont, getDefaultItemLabelPaint, getDefaultItemLabelsVisible, getDefaultNegativeItemLabelPosition, getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultPositiveItemLabelPosition, getDefaultSeriesVisible, getDefaultSeriesVisibleInLegend, getDefaultShape, getDefaultStroke, getItemCreateEntity, getItemFillPaint, getItemLabelFont, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisibleInLegend, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeChangeListener, setDefaultCreateEntities, setDefaultCreateEntities, setDefaultFillPaint, setDefaultFillPaint, setDefaultItemLabelFont, setDefaultItemLabelPaint, setDefaultItemLabelsVisible, setDefaultItemLabelsVisible, setDefaultNegativeItemLabelPosition, setDefaultNegativeItemLabelPosition, setDefaultOutlinePaint, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultOutlineStroke, setDefaultPaint, setDefaultPaint, setDefaultPositiveItemLabelPosition, setDefaultPositiveItemLabelPosition, setDefaultSeriesVisible, setDefaultSeriesVisible, setDefaultSeriesVisibleInLegend, setDefaultSeriesVisibleInLegend, setDefaultShape, setDefaultShape, setDefaultStroke, setDefaultStroke, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
plot
private XYPlot plot
The plot.
-
itemLabelGeneratorMap
private java.util.Map<java.lang.Integer,XYItemLabelGenerator> itemLabelGeneratorMap
A list of item label generators (one per series).
-
defaultItemLabelGenerator
private XYItemLabelGenerator defaultItemLabelGenerator
The default item label generator.
-
toolTipGeneratorMap
private java.util.Map<java.lang.Integer,XYToolTipGenerator> toolTipGeneratorMap
A list of tool tip generators (one per series).
-
defaultToolTipGenerator
private XYToolTipGenerator defaultToolTipGenerator
The default tool tip generator.
-
urlGenerator
private XYURLGenerator urlGenerator
The URL text generator.
-
backgroundAnnotations
private java.util.List backgroundAnnotations
Annotations to be drawn in the background layer ('underneath' the data items).
-
foregroundAnnotations
private java.util.List foregroundAnnotations
Annotations to be drawn in the foreground layer ('on top' of the data items).
-
legendItemLabelGenerator
private XYSeriesLabelGenerator legendItemLabelGenerator
The legend item label generator.
-
legendItemToolTipGenerator
private XYSeriesLabelGenerator legendItemToolTipGenerator
The legend item tool tip generator.
-
legendItemURLGenerator
private XYSeriesLabelGenerator legendItemURLGenerator
The legend item URL generator.
-
-
Method Detail
-
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 interfaceXYItemRenderer
- Returns:
- The pass count.
-
getPlot
public XYPlot getPlot()
Returns the plot that the renderer is assigned to.- Specified by:
getPlot
in interfaceXYItemRenderer
- Returns:
- The plot (possibly
null
).
-
setPlot
public void setPlot(XYPlot plot)
Sets the plot that the renderer is assigned to.- Specified by:
setPlot
in interfaceXYItemRenderer
- Parameters:
plot
- the plot (null
permitted).
-
initialise
public XYItemRendererState initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, XYPlot plot, XYDataset dataset, 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 interfaceXYItemRenderer
- Parameters:
g2
- the graphics device.dataArea
- the area inside the axes.plot
- the plot.dataset
- the dataset.info
- an optional info collection object to return data back to the caller.- Returns:
- The renderer state (never
null
).
-
beginElementGroup
protected void beginElementGroup(java.awt.Graphics2D g2, java.lang.Comparable seriesKey, int itemIndex)
Adds aKEY_BEGIN_ELEMENT
hint to the graphics target. This hint is recognised by JFreeSVG (in theory it could be used by otherGraphics2D
implementations also).- Parameters:
g2
- the graphics target (null
not permitted).seriesKey
- the series key that identifies the element (null
not permitted).itemIndex
- the item index.
-
getItemLabelGenerator
public XYItemLabelGenerator getItemLabelGenerator(int series, int item)
Returns the label generator for a data item. This implementation simply passes control to thegetSeriesItemLabelGenerator(int)
method. If, for some reason, you want a different generator for individual items, you can override this method.- Specified by:
getItemLabelGenerator
in interfaceXYItemRenderer
- Parameters:
series
- the series index (zero based).item
- the item index (zero based).- Returns:
- The generator (possibly
null
).
-
getSeriesItemLabelGenerator
public XYItemLabelGenerator getSeriesItemLabelGenerator(int series)
Returns the item label generator for a series.- Specified by:
getSeriesItemLabelGenerator
in interfaceXYItemRenderer
- Parameters:
series
- the series index (zero based).- Returns:
- The generator (possibly
null
). - See Also:
XYItemRenderer.setSeriesItemLabelGenerator(int, XYItemLabelGenerator)
-
setSeriesItemLabelGenerator
public void setSeriesItemLabelGenerator(int series, XYItemLabelGenerator generator)
Sets the item label generator for a series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setSeriesItemLabelGenerator
in interfaceXYItemRenderer
- Parameters:
series
- the series index (zero based).generator
- the generator (null
permitted).- See Also:
XYItemRenderer.getSeriesItemLabelGenerator(int)
-
getDefaultItemLabelGenerator
public XYItemLabelGenerator getDefaultItemLabelGenerator()
Returns the default item label generator.- Specified by:
getDefaultItemLabelGenerator
in interfaceXYItemRenderer
- Returns:
- The generator (possibly
null
). - See Also:
XYItemRenderer.setDefaultItemLabelGenerator(XYItemLabelGenerator)
-
setDefaultItemLabelGenerator
public void setDefaultItemLabelGenerator(XYItemLabelGenerator generator)
Sets the default item label generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setDefaultItemLabelGenerator
in interfaceXYItemRenderer
- Parameters:
generator
- the generator (null
permitted).- See Also:
XYItemRenderer.getDefaultItemLabelGenerator()
-
getToolTipGenerator
public XYToolTipGenerator getToolTipGenerator(int series, int item)
Returns the tool tip generator for a data item. If, for some reason, you want a different generator for individual items, you can override this method.- Specified by:
getToolTipGenerator
in interfaceXYItemRenderer
- Parameters:
series
- the series index (zero based).item
- the item 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 interfaceXYItemRenderer
- Parameters:
series
- the series index (zero based).- Returns:
- The generator (possibly
null
). - See Also:
XYItemRenderer.setSeriesToolTipGenerator(int, XYToolTipGenerator)
-
setSeriesToolTipGenerator
public void setSeriesToolTipGenerator(int series, XYToolTipGenerator generator)
Sets the tool tip generator for a series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setSeriesToolTipGenerator
in interfaceXYItemRenderer
- Parameters:
series
- the series index (zero based).generator
- the generator (null
permitted).- See Also:
XYItemRenderer.getSeriesToolTipGenerator(int)
-
getDefaultToolTipGenerator
public XYToolTipGenerator getDefaultToolTipGenerator()
Returns the default tool tip generator.- Specified by:
getDefaultToolTipGenerator
in interfaceXYItemRenderer
- Returns:
- The generator (possibly
null
). - See Also:
setDefaultToolTipGenerator(XYToolTipGenerator)
-
setDefaultToolTipGenerator
public void setDefaultToolTipGenerator(XYToolTipGenerator generator)
Sets the default tool tip generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setDefaultToolTipGenerator
in interfaceXYItemRenderer
- Parameters:
generator
- the generator (null
permitted).- See Also:
getDefaultToolTipGenerator()
-
getURLGenerator
public XYURLGenerator getURLGenerator()
Returns the URL generator for HTML image maps.- Specified by:
getURLGenerator
in interfaceXYItemRenderer
- Returns:
- The URL generator (possibly
null
).
-
setURLGenerator
public void setURLGenerator(XYURLGenerator urlGenerator)
Sets the URL generator for HTML image maps and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setURLGenerator
in interfaceXYItemRenderer
- Parameters:
urlGenerator
- the URL generator (null
permitted).
-
addAnnotation
public void addAnnotation(XYAnnotation annotation)
Adds an annotation and sends aRendererChangeEvent
to all registered listeners. The annotation is added to the foreground layer.- Specified by:
addAnnotation
in interfaceXYItemRenderer
- Parameters:
annotation
- the annotation (null
not permitted).
-
addAnnotation
public void addAnnotation(XYAnnotation annotation, Layer layer)
Adds an annotation to the specified layer and sends aRendererChangeEvent
to all registered listeners.- Specified by:
addAnnotation
in interfaceXYItemRenderer
- Parameters:
annotation
- the annotation (null
not permitted).layer
- the layer (null
not permitted).
-
removeAnnotation
public boolean removeAnnotation(XYAnnotation annotation)
Removes the specified annotation and sends aRendererChangeEvent
to all registered listeners.- Specified by:
removeAnnotation
in interfaceXYItemRenderer
- Parameters:
annotation
- the annotation to remove (null
not permitted).- Returns:
- A boolean to indicate whether or not the annotation was successfully removed.
-
removeAnnotations
public void removeAnnotations()
Removes all annotations and sends aRendererChangeEvent
to all registered listeners.- Specified by:
removeAnnotations
in interfaceXYItemRenderer
-
annotationChanged
public void annotationChanged(AnnotationChangeEvent event)
Receives notification of a change to anAnnotation
added to this renderer.- Specified by:
annotationChanged
in interfaceAnnotationChangeListener
- Parameters:
event
- information about the event (not used here).
-
getAnnotations
public java.util.Collection getAnnotations()
Returns a collection of the annotations that are assigned to the renderer.- Returns:
- A collection of annotations (possibly empty but never
null
).
-
getLegendItemLabelGenerator
public XYSeriesLabelGenerator getLegendItemLabelGenerator()
Returns the legend item label generator.- Specified by:
getLegendItemLabelGenerator
in interfaceXYItemRenderer
- Returns:
- The label generator (never
null
). - See Also:
setLegendItemLabelGenerator(XYSeriesLabelGenerator)
-
setLegendItemLabelGenerator
public void setLegendItemLabelGenerator(XYSeriesLabelGenerator generator)
Sets the legend item label generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setLegendItemLabelGenerator
in interfaceXYItemRenderer
- Parameters:
generator
- the generator (null
not permitted).- See Also:
getLegendItemLabelGenerator()
-
getLegendItemToolTipGenerator
public XYSeriesLabelGenerator getLegendItemToolTipGenerator()
Returns the legend item tool tip generator.- Returns:
- The tool tip generator (possibly
null
). - See Also:
setLegendItemToolTipGenerator(XYSeriesLabelGenerator)
-
setLegendItemToolTipGenerator
public void setLegendItemToolTipGenerator(XYSeriesLabelGenerator generator)
Sets the legend item tool tip generator and sends aRendererChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- See Also:
getLegendItemToolTipGenerator()
-
getLegendItemURLGenerator
public XYSeriesLabelGenerator getLegendItemURLGenerator()
Returns the legend item URL generator.- Returns:
- The URL generator (possibly
null
). - See Also:
setLegendItemURLGenerator(XYSeriesLabelGenerator)
-
setLegendItemURLGenerator
public void setLegendItemURLGenerator(XYSeriesLabelGenerator generator)
Sets the legend item URL generator and sends aRendererChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- See Also:
getLegendItemURLGenerator()
-
findDomainBounds
public Range findDomainBounds(XYDataset dataset)
Returns the lower and upper bounds (range) of the x-values in the specified dataset.- Specified by:
findDomainBounds
in interfaceXYItemRenderer
- Parameters:
dataset
- the dataset (null
permitted).- Returns:
- The range (
null
if the dataset isnull
or empty). - See Also:
findRangeBounds(XYDataset)
-
findDomainBounds
protected Range findDomainBounds(XYDataset dataset, boolean includeInterval)
Returns the lower and upper bounds (range) of the x-values in the specified dataset.- Parameters:
dataset
- the dataset (null
permitted).includeInterval
- include the interval (if any) for the dataset?- Returns:
- The range (
null
if the dataset isnull
or empty).
-
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:
findRangeBounds
in interfaceXYItemRenderer
- Parameters:
dataset
- the dataset (null
permitted).- Returns:
- The range (
null
if the dataset isnull
or empty). - See Also:
findDomainBounds(XYDataset)
-
findRangeBounds
protected Range findRangeBounds(XYDataset dataset, boolean includeInterval)
Returns the range of values the renderer requires to display all the items from the specified dataset.- Parameters:
dataset
- the dataset (null
permitted).includeInterval
- include the interval (if any) for the dataset?- Returns:
- The range (
null
if the dataset isnull
or empty).
-
getLegendItems
public LegendItemCollection getLegendItems()
Returns a (possibly empty) collection of legend items for the series that this renderer is responsible for drawing.- Specified by:
getLegendItems
in interfaceLegendItemSource
- Returns:
- The legend item collection (never
null
).
-
getLegendItem
public LegendItem getLegendItem(int datasetIndex, int series)
Returns a default legend item for the specified series. Subclasses should override this method to generate customised items.- Specified by:
getLegendItem
in 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(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.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 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(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.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 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.
-
drawDomainLine
public void drawDomainLine(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Paint paint, java.awt.Stroke stroke)
Draws a line perpendicular to the domain axis.- Specified by:
drawDomainLine
in interfaceXYItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.axis
- the value axis.dataArea
- the area for plotting data.value
- the value at which the grid line should be drawn.paint
- the paint (null
not permitted).stroke
- the stroke (null
not permitted).
-
drawRangeLine
public void drawRangeLine(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Paint paint, java.awt.Stroke stroke)
Draws a line perpendicular to the range axis.- Specified by:
drawRangeLine
in interfaceXYItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.axis
- the value axis.dataArea
- the area for plotting data.value
- the value at which the grid line should be drawn.paint
- the paint.stroke
- the stroke.
-
drawDomainMarker
public void drawDomainMarker(java.awt.Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, java.awt.geom.Rectangle2D dataArea)
Draws a line on the chart perpendicular to the x-axis to mark a value or range of values.- Specified by:
drawDomainMarker
in interfaceXYItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.domainAxis
- the domain axis.marker
- the marker line.dataArea
- the axis data area.
-
calculateDomainMarkerTextAnchorPoint
protected java.awt.geom.Point2D calculateDomainMarkerTextAnchorPoint(java.awt.Graphics2D g2, PlotOrientation orientation, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetType, RectangleAnchor anchor)
Calculates the(x, y)
coordinates for drawing a marker label.- Parameters:
g2
- the graphics device.orientation
- the plot orientation.dataArea
- the data area.markerArea
- the rectangle surrounding the marker area.markerOffset
- the marker label offset.labelOffsetType
- the label offset type.anchor
- the label anchor.- Returns:
- The coordinates for drawing the marker label.
-
drawRangeMarker
public void drawRangeMarker(java.awt.Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, java.awt.geom.Rectangle2D dataArea)
Draws a line on the chart perpendicular to the y-axis to mark a value or range of values.- Specified by:
drawRangeMarker
in interfaceXYItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.rangeAxis
- the range axis.marker
- the marker line.dataArea
- the axis data area.
-
calculateRangeMarkerTextAnchorPoint
private java.awt.geom.Point2D calculateRangeMarkerTextAnchorPoint(java.awt.Graphics2D g2, PlotOrientation orientation, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetForRange, RectangleAnchor anchor)
Calculates the (x, y) coordinates for drawing a marker label.- Parameters:
g2
- the graphics device.orientation
- the plot orientation.dataArea
- the data area.markerArea
- the marker area.markerOffset
- the marker offset.labelOffsetForRange
- ??anchor
- the label anchor.- Returns:
- The coordinates for drawing the marker label.
-
clone
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of the renderer.- Overrides:
clone
in classAbstractRenderer
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- if the renderer does not support cloning.
-
equals
public boolean equals(java.lang.Object obj)
Tests this renderer for equality with another object.- Overrides:
equals
in classAbstractRenderer
- Parameters:
obj
- the object (null
permitted).- Returns:
true
orfalse
.
-
hashCode
public int hashCode()
Description copied from class:AbstractRenderer
Returns a hashcode for the renderer.- Overrides:
hashCode
in classAbstractRenderer
- Returns:
- The hashcode.
-
getDrawingSupplier
public DrawingSupplier getDrawingSupplier()
Returns the drawing supplier from the plot.- Specified by:
getDrawingSupplier
in classAbstractRenderer
- Returns:
- The drawing supplier (possibly
null
).
-
updateCrosshairValues
protected void updateCrosshairValues(CrosshairState crosshairState, double x, double y, int datasetIndex, double transX, double transY, PlotOrientation orientation)
Considers the current (x, y) coordinate and updates the crosshair point if it meets the criteria (usually means the (x, y) coordinate is the closest to the anchor point so far).- Parameters:
crosshairState
- the crosshair state (null
permitted, but the method does nothing in that case).x
- the x-value (in data space).y
- the y-value (in data space).datasetIndex
- the index of the dataset for the point.transX
- the x-value translated to Java2D space.transY
- the y-value translated to Java2D space.orientation
- the plot orientation (null
not permitted).
-
drawItemLabel
protected void drawItemLabel(java.awt.Graphics2D g2, PlotOrientation orientation, XYDataset dataset, int series, int item, double x, double y, boolean negative)
Draws an item label.- Parameters:
g2
- the graphics device.orientation
- the orientation.dataset
- the dataset.series
- the series index (zero-based).item
- the item index (zero-based).x
- the x coordinate (in Java2D space).y
- the y coordinate (in Java2D space).negative
- indicates a negative value (which affects the item label position).
-
drawAnnotations
public void drawAnnotations(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer, PlotRenderingInfo info)
Draws all the annotations for the specified layer.- Specified by:
drawAnnotations
in interfaceXYItemRenderer
- Parameters:
g2
- the graphics device.dataArea
- the data area.domainAxis
- the domain axis.rangeAxis
- the range axis.layer
- the layer (null
not permitted).info
- the plot rendering info.
-
addEntity
protected void addEntity(EntityCollection entities, java.awt.Shape hotspot, XYDataset dataset, int series, int item, double entityX, double entityY)
Adds an entity to the collection. Note the theentityX
andentityY
coordinates are in Java2D space, should already be adjusted for the plot orientation, and will only be used ifhotspot
isnull
.- Parameters:
entities
- the entity collection being populated.hotspot
- the entity area (ifnull
a default will be used).dataset
- the dataset.series
- the series.item
- the item.entityX
- the entity x-coordinate (in Java2D space, only used ifhotspot
isnull
).entityY
- the entity y-coordinate (in Java2D space, only used ifhotspot
isnull
).
-
moveTo
protected static void moveTo(java.awt.geom.GeneralPath hotspot, double x, double y)
Utility method delegating toPath2D.Float.moveTo(double, double)
taking double as parameters.- Parameters:
hotspot
- the region under construction (null
not permitted);x
- the x coordinate;y
- the y coordinate;
-
lineTo
protected static void lineTo(java.awt.geom.GeneralPath hotspot, double x, double y)
Utility method delegating toPath2D.Float.lineTo(double, double)
taking double as parameters.- Parameters:
hotspot
- the region under construction (null
not permitted);x
- the x coordinate;y
- the y coordinate;
-
-