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:
Serializable,Cloneable,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, Cloneable, Serializable
A base class that can be used to create new
XYItemRenderer
implementations.- See Also:
-
Field Summary
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
ConstructorsModifierConstructorDescriptionprotectedCreates a renderer where the tooltip generator and the URL generator are bothnull. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(XYAnnotation annotation) Adds an annotation and sends aRendererChangeEventto all registered listeners.voidaddAnnotation(XYAnnotation annotation, Layer layer) Adds an annotation to the specified layer and sends aRendererChangeEventto all registered listeners.protected voidaddEntity(EntityCollection entities, Shape hotspot, XYDataset dataset, int series, int item, double entityX, double entityY) Adds an entity to the collection.voidReceives notification of a change to anAnnotationadded to this renderer.protected voidbeginElementGroup(Graphics2D g2, Comparable seriesKey, int itemIndex) Adds aKEY_BEGIN_ELEMENThint to the graphics target.protected Point2DcalculateDomainMarkerTextAnchorPoint(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetType, RectangleAnchor anchor) Calculates the(x, y)coordinates for drawing a marker label.protected Objectclone()Returns a clone of the renderer.voiddrawAnnotations(Graphics2D g2, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer, PlotRenderingInfo info) Draws all the annotations for the specified layer.voiddrawDomainLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) Draws a line perpendicular to the domain axis.voiddrawDomainMarker(Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, Rectangle2D dataArea) Draws a line on the chart perpendicular to the x-axis to mark a value or range of values.protected voiddrawItemLabel(Graphics2D g2, PlotOrientation orientation, XYDataset dataset, int series, int item, double x, double y, boolean negative) Draws an item label.voiddrawRangeLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) Draws a line perpendicular to the range axis.voiddrawRangeMarker(Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea) Draws a line on the chart perpendicular to the y-axis to mark a value or range of values.booleanTests 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.findDomainBounds(XYDataset dataset) Returns the lower and upper bounds (range) of the x-values in the specified dataset.protected RangefindDomainBounds(XYDataset dataset, boolean includeInterval) Returns the lower and upper bounds (range) of the x-values in the specified dataset.findRangeBounds(XYDataset dataset) Returns the range of values the renderer requires to display all the items from the specified dataset.protected RangefindRangeBounds(XYDataset dataset, boolean includeInterval) Returns the range of values the renderer requires to display all the items from the specified dataset.Returns a collection of the annotations that are assigned to the renderer.Returns the default item label generator.Returns the default tool tip generator.Returns the drawing supplier from the plot.getItemLabelGenerator(int series, int item) Returns the label generator for a data item.getLegendItem(int datasetIndex, int series) Returns a default legend item for the specified series.Returns the legend item label generator.Returns a (possibly empty) collection of legend items for the series that this renderer is responsible for drawing.Returns the legend item tool tip generator.Returns the legend item URL generator.intReturns the number of passes through the data that the renderer requires in order to draw the chart.getPlot()Returns the plot that the renderer is assigned to.getSeriesItemLabelGenerator(int series) Returns the item label generator for a series.getSeriesToolTipGenerator(int series) Returns the tool tip generator for a series.getToolTipGenerator(int series, int item) Returns the tool tip generator for a data item.Returns the URL generator for HTML image maps.inthashCode()Returns a hashcode for the renderer.initialise(Graphics2D g2, 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 voidlineTo(GeneralPath hotspot, double x, double y) Utility method delegating toPath2D.Float.lineTo(double, double)taking double as parameters.protected static voidmoveTo(GeneralPath hotspot, double x, double y) Utility method delegating toPath2D.Float.moveTo(double, double)taking double as parameters.booleanremoveAnnotation(XYAnnotation annotation) Removes the specified annotation and sends aRendererChangeEventto all registered listeners.voidRemoves all annotations and sends aRendererChangeEventto all registered listeners.voidsetDefaultItemLabelGenerator(XYItemLabelGenerator generator) Sets the default item label generator and sends aRendererChangeEventto all registered listeners.voidsetDefaultToolTipGenerator(XYToolTipGenerator generator) Sets the default tool tip generator and sends aRendererChangeEventto all registered listeners.voidSets the legend item label generator and sends aRendererChangeEventto all registered listeners.voidSets the legend item tool tip generator and sends aRendererChangeEventto all registered listeners.voidsetLegendItemURLGenerator(XYSeriesLabelGenerator generator) Sets the legend item URL generator and sends aRendererChangeEventto all registered listeners.voidSets the plot that the renderer is assigned to.voidsetSeriesItemLabelGenerator(int series, XYItemLabelGenerator generator) Sets the item 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.voidsetURLGenerator(XYURLGenerator urlGenerator) Sets the URL generator for HTML image maps and sends aRendererChangeEventto all registered listeners.protected voidupdateCrosshairValues(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, setTreatLegendShapeAsLineMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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
-
Constructor Details
-
AbstractXYItemRenderer
protected AbstractXYItemRenderer()Creates a renderer where the tooltip generator and the URL generator are bothnull.
-
-
Method Details
-
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 (possibly
null).
-
setPlot
Sets the plot that the renderer is assigned to.- Specified by:
setPlotin interfaceXYItemRenderer- Parameters:
plot- the plot (nullpermitted).
-
initialise
public XYItemRendererState initialise(Graphics2D g2, 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:
initialisein 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
Adds aKEY_BEGIN_ELEMENThint to the graphics target. This hint is recognised by JFreeSVG (in theory it could be used by otherGraphics2Dimplementations also).- Parameters:
g2- the graphics target (nullnot permitted).seriesKey- the series key that identifies the element (nullnot permitted).itemIndex- the item index.
-
getItemLabelGenerator
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:
getItemLabelGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).item- the item index (zero based).- Returns:
- The generator (possibly
null).
-
getSeriesItemLabelGenerator
Returns the item label generator for a series.- Specified by:
getSeriesItemLabelGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).- Returns:
- The generator (possibly
null). - See Also:
-
setSeriesItemLabelGenerator
Sets the item label generator for a series and sends aRendererChangeEventto all registered listeners.- Specified by:
setSeriesItemLabelGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).generator- the generator (nullpermitted).- See Also:
-
getDefaultItemLabelGenerator
Returns the default item label generator.- Specified by:
getDefaultItemLabelGeneratorin interfaceXYItemRenderer- Returns:
- The generator (possibly
null). - See Also:
-
setDefaultItemLabelGenerator
Sets the default item label generator and sends aRendererChangeEventto all registered listeners.- Specified by:
setDefaultItemLabelGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullpermitted).- See Also:
-
getToolTipGenerator
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:
getToolTipGeneratorin interfaceXYItemRenderer- Parameters:
series- the series index (zero based).item- the item 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). - See Also:
-
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).- See Also:
-
getDefaultToolTipGenerator
Returns the default tool tip generator.- Specified by:
getDefaultToolTipGeneratorin interfaceXYItemRenderer- Returns:
- The generator (possibly
null). - See Also:
-
setDefaultToolTipGenerator
Sets the default tool tip generator and sends aRendererChangeEventto all registered listeners.- Specified by:
setDefaultToolTipGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullpermitted).- See Also:
-
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 and sends aRendererChangeEventto all registered listeners.- Specified by:
setURLGeneratorin interfaceXYItemRenderer- Parameters:
urlGenerator- the URL generator (nullpermitted).
-
addAnnotation
Adds an annotation and sends aRendererChangeEventto all registered listeners. The annotation is added to the foreground layer.- Specified by:
addAnnotationin interfaceXYItemRenderer- Parameters:
annotation- the annotation (nullnot permitted).
-
addAnnotation
Adds an annotation to the specified layer and sends aRendererChangeEventto all registered listeners.- Specified by:
addAnnotationin interfaceXYItemRenderer- Parameters:
annotation- the annotation (nullnot permitted).layer- the layer (nullnot permitted).
-
removeAnnotation
Removes the specified annotation and sends aRendererChangeEventto all registered listeners.- Specified by:
removeAnnotationin interfaceXYItemRenderer- Parameters:
annotation- the annotation to remove (nullnot permitted).- Returns:
- A boolean to indicate whether or not the annotation was successfully removed.
-
removeAnnotations
Removes all annotations and sends aRendererChangeEventto all registered listeners.- Specified by:
removeAnnotationsin interfaceXYItemRenderer
-
annotationChanged
Receives notification of a change to anAnnotationadded to this renderer.- Specified by:
annotationChangedin interfaceAnnotationChangeListener- Parameters:
event- information about the event (not used here).
-
getAnnotations
Returns a collection of the annotations that are assigned to the renderer.- Returns:
- A collection of annotations (possibly empty but never
null).
-
getLegendItemLabelGenerator
Returns the legend item label generator.- Specified by:
getLegendItemLabelGeneratorin interfaceXYItemRenderer- Returns:
- The label generator (never
null). - See Also:
-
setLegendItemLabelGenerator
Sets the legend item label generator and sends aRendererChangeEventto all registered listeners.- Specified by:
setLegendItemLabelGeneratorin interfaceXYItemRenderer- Parameters:
generator- the generator (nullnot permitted).- See Also:
-
getLegendItemToolTipGenerator
Returns the legend item tool tip generator.- Returns:
- The tool tip generator (possibly
null). - See Also:
-
setLegendItemToolTipGenerator
Sets the legend item tool tip generator and sends aRendererChangeEventto all registered listeners.- Parameters:
generator- the generator (nullpermitted).- See Also:
-
getLegendItemURLGenerator
Returns the legend item URL generator.- Returns:
- The URL generator (possibly
null). - See Also:
-
setLegendItemURLGenerator
Sets the legend item URL generator and sends aRendererChangeEventto all registered listeners.- Parameters:
generator- the generator (nullpermitted).- See Also:
-
findDomainBounds
Returns the lower and upper bounds (range) of the x-values in the specified dataset.- Specified by:
findDomainBoundsin interfaceXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (
nullif the dataset isnullor empty). - See Also:
-
findDomainBounds
Returns the lower and upper bounds (range) of the x-values in the specified dataset.- Parameters:
dataset- the dataset (nullpermitted).includeInterval- include the interval (if any) for the dataset?- Returns:
- The range (
nullif the dataset isnullor empty).
-
findRangeBounds
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
findRangeBoundsin interfaceXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (
nullif the dataset isnullor empty). - See Also:
-
findRangeBounds
Returns the range of values the renderer requires to display all the items from the specified dataset.- Parameters:
dataset- the dataset (nullpermitted).includeInterval- include the interval (if any) for the dataset?- Returns:
- The range (
nullif the dataset isnullor empty).
-
getLegendItems
Returns a (possibly empty) collection of legend items for the series that this renderer is responsible for drawing.- Specified by:
getLegendItemsin interfaceLegendItemSource- Returns:
- The legend item collection (never
null).
-
getLegendItem
Returns a default legend item for the specified series. Subclasses should override this method to generate customised items.- 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.
-
drawDomainLine
public void drawDomainLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) Draws a line perpendicular to the domain axis.- Specified by:
drawDomainLinein 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 (nullnot permitted).stroke- the stroke (nullnot permitted).
-
drawRangeLine
public void drawRangeLine(Graphics2D g2, XYPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) Draws a line perpendicular to the range axis.- Specified by:
drawRangeLinein 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(Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, Rectangle2D dataArea) Draws a line on the chart perpendicular to the x-axis to mark a value or range of values.- 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.
-
calculateDomainMarkerTextAnchorPoint
protected Point2D calculateDomainMarkerTextAnchorPoint(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, 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(Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea) Draws a line on the chart perpendicular to the y-axis to mark a value or range of values.- 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.
-
clone
Returns a clone of the renderer.- Overrides:
clonein classAbstractRenderer- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if the renderer does not support cloning.
-
equals
Tests this renderer for equality with another object.- Overrides:
equalsin classAbstractRenderer- Parameters:
obj- the object (nullpermitted).- Returns:
trueorfalse.
-
hashCode
Description copied from class:AbstractRendererReturns a hashcode for the renderer.- Overrides:
hashCodein classAbstractRenderer- Returns:
- The hashcode.
-
getDrawingSupplier
Returns the drawing supplier from the plot.- Specified by:
getDrawingSupplierin 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 (nullpermitted, 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 (nullnot permitted).
-
drawItemLabel
protected void drawItemLabel(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(Graphics2D g2, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, Layer layer, PlotRenderingInfo info) Draws all the annotations for the specified layer.- Specified by:
drawAnnotationsin interfaceXYItemRenderer- Parameters:
g2- the graphics device.dataArea- the data area.domainAxis- the domain axis.rangeAxis- the range axis.layer- the layer (nullnot permitted).info- the plot rendering info.
-
addEntity
protected void addEntity(EntityCollection entities, Shape hotspot, XYDataset dataset, int series, int item, double entityX, double entityY) Adds an entity to the collection. Note the theentityXandentityYcoordinates are in Java2D space, should already be adjusted for the plot orientation, and will only be used ifhotspotisnull.- Parameters:
entities- the entity collection being populated.hotspot- the entity area (ifnulla default will be used).dataset- the dataset.series- the series.item- the item.entityX- the entity x-coordinate (in Java2D space, only used ifhotspotisnull).entityY- the entity y-coordinate (in Java2D space, only used ifhotspotisnull).
-
moveTo
Utility method delegating toPath2D.Float.moveTo(double, double)taking double as parameters.- Parameters:
hotspot- the region under construction (nullnot permitted);x- the x coordinate;y- the y coordinate;
-
lineTo
Utility method delegating toPath2D.Float.lineTo(double, double)taking double as parameters.- Parameters:
hotspot- the region under construction (nullnot permitted);x- the x coordinate;y- the y coordinate;
-