Class AbstractCategoryItemRenderer
java.lang.Object
org.jfree.chart.renderer.AbstractRenderer
org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
- All Implemented Interfaces:
Serializable
,Cloneable
,LegendItemSource
,CategoryItemRenderer
,org.jfree.util.PublicCloneable
- Direct Known Subclasses:
AreaRenderer
,BarRenderer
,BoxAndWhiskerRenderer
,CategoryStepRenderer
,LevelRenderer
,LineAndShapeRenderer
,MinMaxCategoryRenderer
,ScatterRenderer
public abstract class AbstractCategoryItemRenderer
extends AbstractRenderer
implements CategoryItemRenderer, Cloneable, org.jfree.util.PublicCloneable, Serializable
An abstract base class that you can use to implement a new
CategoryItemRenderer
. When you create a new
CategoryItemRenderer
you are not required to extend this class,
but it makes the job easier.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CategoryItemLabelGenerator
The base item label generator.private CategoryURLGenerator
The base item label generator.private CategoryToolTipGenerator
The base tool tip generator.private int
The number of columns in the dataset (temporary record).private CategoryItemLabelGenerator
Deprecated.This field is redundant and deprecated as of version 1.0.6.private Map<Integer,
CategoryItemLabelGenerator> A list of item label generators (one per series).private CategoryURLGenerator
Deprecated.This field is redundant and deprecated as of version 1.0.6.private Map<Integer,
CategoryURLGenerator> A list of item label generators (one per series).private CategorySeriesLabelGenerator
The legend item label generator.private CategorySeriesLabelGenerator
The legend item tool tip generator.private CategorySeriesLabelGenerator
The legend item URL generator.private CategoryPlot
The plot that the renderer is assigned to.private int
The number of rows in the dataset (temporary record).private static final long
For serialization.private CategoryToolTipGenerator
Deprecated.This field is redundant and deprecated as of version 1.0.6.private Map<Integer,
CategoryToolTipGenerator> A list of tool tip generators (one per series).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
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a new renderer with no tool tip generator and no URL generator. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addEntity
(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, double entityX, double entityY) Adds an entity to the collection.protected void
addItemEntity
(EntityCollection entities, CategoryDataset dataset, int row, int column, Shape hotspot) Adds an entity with the specified hotspot.protected Point2D
calculateDomainMarkerTextAnchorPoint
(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, org.jfree.ui.RectangleInsets markerOffset, org.jfree.ui.LengthAdjustmentType labelOffsetType, org.jfree.ui.RectangleAnchor anchor) Calculates the (x, y) coordinates for drawing the label for a marker on the range axis.protected Point2D
calculateRangeMarkerTextAnchorPoint
(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, org.jfree.ui.RectangleInsets markerOffset, org.jfree.ui.LengthAdjustmentType labelOffsetType, org.jfree.ui.RectangleAnchor anchor) Calculates the (x, y) coordinates for drawing a marker label.clone()
Returns an independent copy of the renderer.protected CategoryItemRendererState
createState
(PlotRenderingInfo info) Creates a new state instance---this method is called from theinitialise(Graphics2D, Rectangle2D, CategoryPlot, int, PlotRenderingInfo)
method.void
drawBackground
(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) Draws a background for the data area.void
drawDomainGridline
(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, double value) Draws a grid line against the domain axis.void
drawDomainMarker
(Graphics2D g2, CategoryPlot plot, CategoryAxis axis, CategoryMarker marker, Rectangle2D dataArea) Draws a marker for the domain axis.protected void
drawItemLabel
(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, double x, double y, boolean negative) Draws an item label.void
drawOutline
(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) Draws an outline for the data area.void
drawRangeGridline
(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Rectangle2D dataArea, double value) Draws a grid line against the range axis.void
drawRangeLine
(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) Draws a line perpendicular to the range axis.void
drawRangeMarker
(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, Rectangle2D dataArea) Draws a marker for the range axis.boolean
Tests this renderer for equality with another object.findRangeBounds
(CategoryDataset dataset) Returns the range of values the renderer requires to display all the items from the specified dataset.protected Range
findRangeBounds
(CategoryDataset dataset, boolean includeInterval) Returns the range of values the renderer requires to display all the items from the specified dataset.Returns the base item label generator.Returns the base item URL generator.Returns the base tool tip generator (the "layer 2" generator).int
Returns the number of columns in the dataset.protected CategoryAxis
getDomainAxis
(CategoryPlot plot, int index) Returns a domain axis for a plot.Returns the drawing supplier from the plot.getItemLabelGenerator
(int row, int column) Returns the item label generator for a data item.double
getItemMiddle
(Comparable rowKey, Comparable columnKey, CategoryDataset dataset, CategoryAxis axis, Rectangle2D area, org.jfree.ui.RectangleEdge edge) Returns the Java2D coordinate for the middle of the specified data item.getItemURLGenerator
(int row, int column) Returns the URL generator for a data item.getLegendItem
(int datasetIndex, int series) Returns a legend item for a 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.int
Returns the number of passes through the dataset required by the renderer.getPlot()
Returns the plot that the renderer has been assigned to (wherenull
indicates that the renderer is not currently assigned to a plot).protected ValueAxis
getRangeAxis
(CategoryPlot plot, int index) Returns a range axis for a plot.int
Returns the number of rows in the dataset.getSeriesItemLabelGenerator
(int series) Returns the item label generator for a series.getSeriesItemURLGenerator
(int series) Returns the URL generator for a series.getSeriesToolTipGenerator
(int series) Returns the tool tip generator for the specified series (a "layer 1" generator).Deprecated.This method should no longer be used (as of version 1.0.6).getToolTipGenerator
(int row, int column) Returns the tool tip generator that should be used for the specified item.int
hashCode()
Returns a hash code for the renderer.initialise
(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info) Initialises the renderer and returns a state object that will be used for the remainder of the drawing process for a single chart.void
Sets the base item label generator and sends aRendererChangeEvent
to all registered listeners.void
setBaseItemURLGenerator
(CategoryURLGenerator generator) Sets the base item URL generator and sends aRendererChangeEvent
to all registered listeners.void
setBaseToolTipGenerator
(CategoryToolTipGenerator generator) Sets the base tool tip generator and sends aRendererChangeEvent
to all registered listeners.void
setItemLabelGenerator
(CategoryItemLabelGenerator generator) Deprecated.This method should no longer be used (as of version 1.0.6).void
setItemURLGenerator
(CategoryURLGenerator generator) Deprecated.This method should no longer be used (as of version 1.0.6).void
Sets the legend item label generator and sends aRendererChangeEvent
to all registered listeners.void
Sets the legend item tool tip generator and sends aRendererChangeEvent
to all registered listeners.void
Sets the legend item URL generator and sends aRendererChangeEvent
to all registered listeners.void
setPlot
(CategoryPlot plot) Sets the plot that the renderer has been assigned to.void
setSeriesItemLabelGenerator
(int series, CategoryItemLabelGenerator generator) Sets the item label generator for a series and sends aRendererChangeEvent
to all registered listeners.void
setSeriesItemURLGenerator
(int series, CategoryURLGenerator generator) Sets the URL generator for a series and sends aRendererChangeEvent
to all registered listeners.void
setSeriesToolTipGenerator
(int series, CategoryToolTipGenerator generator) Sets the tool tip generator for a series and sends aRendererChangeEvent
to all registered listeners.void
setToolTipGenerator
(CategoryToolTipGenerator generator) Deprecated.This method should no longer be used (as of version 1.0.6).protected void
updateCrosshairValues
(CategoryCrosshairState crosshairState, Comparable rowKey, Comparable columnKey, double value, 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, calculateLabelAnchorPoint, clearSeriesPaints, clearSeriesStrokes, fireChangeEvent, getAutoPopulateSeriesFillPaint, getAutoPopulateSeriesOutlinePaint, getAutoPopulateSeriesOutlineStroke, getAutoPopulateSeriesPaint, getAutoPopulateSeriesShape, getAutoPopulateSeriesStroke, getBaseCreateEntities, getBaseFillPaint, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseLegendShape, getBaseLegendTextFont, getBaseLegendTextPaint, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getCreateEntities, getDataBoundsIncludesVisibleSeriesOnly, getDefaultEntityRadius, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendShape, getLegendTextFont, getLegendTextPaint, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, getTreatLegendShapeAsLine, hasListener, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, lookupLegendShape, lookupLegendTextFont, lookupLegendTextPaint, lookupSeriesFillPaint, lookupSeriesOutlinePaint, lookupSeriesOutlineStroke, lookupSeriesPaint, lookupSeriesShape, lookupSeriesStroke, notifyListeners, removeChangeListener, setAutoPopulateSeriesFillPaint, setAutoPopulateSeriesOutlinePaint, setAutoPopulateSeriesOutlineStroke, setAutoPopulateSeriesPaint, setAutoPopulateSeriesShape, setAutoPopulateSeriesStroke, setBaseCreateEntities, setBaseCreateEntities, setBaseFillPaint, setBaseFillPaint, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseLegendShape, setBaseLegendTextFont, setBaseLegendTextPaint, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setCreateEntities, setCreateEntities, setDataBoundsIncludesVisibleSeriesOnly, setDefaultEntityRadius, setFillPaint, setFillPaint, setItemLabelAnchorOffset, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setLegendShape, setLegendTextFont, setLegendTextPaint, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlinePaint, setOutlineStroke, setOutlineStroke, setPaint, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, 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, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setShape, setStroke, setStroke, setTreatLegendShapeAsLine
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.chart.renderer.category.CategoryItemRenderer
addChangeListener, drawItem, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, 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, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setStroke
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
plot
The plot that the renderer is assigned to. -
itemLabelGeneratorMap
A list of item label generators (one per series). -
baseItemLabelGenerator
The base item label generator. -
toolTipGeneratorMap
A list of tool tip generators (one per series). -
baseToolTipGenerator
The base tool tip generator. -
itemURLGeneratorMap
A list of item label generators (one per series). -
baseItemURLGenerator
The base item label generator. -
legendItemLabelGenerator
The legend item label generator. -
legendItemToolTipGenerator
The legend item tool tip generator. -
legendItemURLGenerator
The legend item URL generator. -
rowCount
private transient int rowCountThe number of rows in the dataset (temporary record). -
columnCount
private transient int columnCountThe number of columns in the dataset (temporary record). -
itemLabelGenerator
Deprecated.This field is redundant and deprecated as of version 1.0.6.The item label generator for ALL series. -
toolTipGenerator
Deprecated.This field is redundant and deprecated as of version 1.0.6.The tool tip generator for ALL series. -
itemURLGenerator
Deprecated.This field is redundant and deprecated as of version 1.0.6.The URL generator.
-
-
Constructor Details
-
AbstractCategoryItemRenderer
protected AbstractCategoryItemRenderer()Creates a new renderer with no tool tip generator and no URL generator. The defaults (no tool tip or URL generators) have been chosen to minimise the processing required to generate a default chart. If you require tool tips or URLs, then you can easily add the required generators.
-
-
Method Details
-
getPassCount
public int getPassCount()Returns the number of passes through the dataset required by the renderer. This method returns1
, subclasses should override if they need more passes.- Specified by:
getPassCount
in interfaceCategoryItemRenderer
- Returns:
- The pass count.
-
getPlot
Returns the plot that the renderer has been assigned to (wherenull
indicates that the renderer is not currently assigned to a plot).- Specified by:
getPlot
in interfaceCategoryItemRenderer
- Returns:
- The plot (possibly
null
). - See Also:
-
setPlot
Sets the plot that the renderer has been assigned to. This method is usually called by theCategoryPlot
, in normal usage you shouldn't need to call this method directly.- Specified by:
setPlot
in interfaceCategoryItemRenderer
- Parameters:
plot
- the plot (null
not permitted).- See Also:
-
getItemLabelGenerator
Returns the item 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 interfaceCategoryItemRenderer
- Parameters:
row
- the row index (zero based).column
- the column index (zero based).- Returns:
- The generator (possibly
null
).
-
getSeriesItemLabelGenerator
Returns the item label generator for a series.- Specified by:
getSeriesItemLabelGenerator
in interfaceCategoryItemRenderer
- 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 aRendererChangeEvent
to all registered listeners.- Specified by:
setSeriesItemLabelGenerator
in interfaceCategoryItemRenderer
- Parameters:
series
- the series index (zero based).generator
- the generator (null
permitted).- See Also:
-
getBaseItemLabelGenerator
Returns the base item label generator.- Specified by:
getBaseItemLabelGenerator
in interfaceCategoryItemRenderer
- Returns:
- The generator (possibly
null
). - See Also:
-
setBaseItemLabelGenerator
Sets the base item label generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setBaseItemLabelGenerator
in interfaceCategoryItemRenderer
- Parameters:
generator
- the generator (null
permitted).- See Also:
-
getToolTipGenerator
Returns the tool tip generator that should be used for the specified item. This method looks up the generator using the "three-layer" approach outlined in the general description of this interface. You can override this method if you want to return a different generator per item.- Specified by:
getToolTipGenerator
in interfaceCategoryItemRenderer
- 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 the specified series (a "layer 1" generator).- Specified by:
getSeriesToolTipGenerator
in interfaceCategoryItemRenderer
- Parameters:
series
- the series index (zero-based).- Returns:
- The tool tip generator (possibly
null
). - See Also:
-
setSeriesToolTipGenerator
Sets the tool tip generator for a series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setSeriesToolTipGenerator
in interfaceCategoryItemRenderer
- Parameters:
series
- the series index (zero-based).generator
- the generator (null
permitted).- See Also:
-
getBaseToolTipGenerator
Returns the base tool tip generator (the "layer 2" generator).- Specified by:
getBaseToolTipGenerator
in interfaceCategoryItemRenderer
- Returns:
- The tool tip generator (possibly
null
). - See Also:
-
setBaseToolTipGenerator
Sets the base tool tip generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setBaseToolTipGenerator
in interfaceCategoryItemRenderer
- Parameters:
generator
- the generator (null
permitted).- See Also:
-
getItemURLGenerator
Returns the URL generator for a data item. This method just calls the getSeriesItemURLGenerator method, but you can override this behaviour if you want to.- Specified by:
getItemURLGenerator
in interfaceCategoryItemRenderer
- Parameters:
row
- the row index (zero based).column
- the column index (zero based).- Returns:
- The URL generator.
-
getSeriesItemURLGenerator
Returns the URL generator for a series.- Specified by:
getSeriesItemURLGenerator
in interfaceCategoryItemRenderer
- Parameters:
series
- the series index (zero based).- Returns:
- The URL generator for the series.
- See Also:
-
setSeriesItemURLGenerator
Sets the URL generator for a series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setSeriesItemURLGenerator
in interfaceCategoryItemRenderer
- Parameters:
series
- the series index (zero based).generator
- the generator.- See Also:
-
getBaseItemURLGenerator
Returns the base item URL generator.- Specified by:
getBaseItemURLGenerator
in interfaceCategoryItemRenderer
- Returns:
- The item URL generator.
- See Also:
-
setBaseItemURLGenerator
Sets the base item URL generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setBaseItemURLGenerator
in interfaceCategoryItemRenderer
- Parameters:
generator
- the item URL generator (null
permitted).- See Also:
-
getRowCount
public int getRowCount()Returns the number of rows in the dataset. This value is updated in theinitialise(java.awt.Graphics2D, java.awt.geom.Rectangle2D, org.jfree.chart.plot.CategoryPlot, int, org.jfree.chart.plot.PlotRenderingInfo)
method.- Returns:
- The row count.
-
getColumnCount
public int getColumnCount()Returns the number of columns in the dataset. This value is updated in theinitialise(java.awt.Graphics2D, java.awt.geom.Rectangle2D, org.jfree.chart.plot.CategoryPlot, int, org.jfree.chart.plot.PlotRenderingInfo)
method.- Returns:
- The column count.
-
createState
Creates a new state instance---this method is called from theinitialise(Graphics2D, Rectangle2D, CategoryPlot, int, PlotRenderingInfo)
method. Subclasses can override this method if they need to use a subclass ofCategoryItemRendererState
.- Parameters:
info
- collects plot rendering info (null
permitted).- Returns:
- The new state instance (never
null
). - Since:
- 1.0.5
-
initialise
public CategoryItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info) Initialises the renderer and returns a state object that will be used for the remainder of the drawing process for a single chart. The state object allows for the fact that the renderer may be used simultaneously by multiple threads (each thread will work with a separate state object).- Specified by:
initialise
in interfaceCategoryItemRenderer
- Parameters:
g2
- the graphics device.dataArea
- the data area.plot
- the plot.rendererIndex
- the renderer index.info
- an object for returning information about the structure of the plot (null
permitted).- Returns:
- The renderer state.
-
findRangeBounds
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
findRangeBounds
in interfaceCategoryItemRenderer
- Parameters:
dataset
- the dataset (null
permitted).- Returns:
- The range (or
null
if the dataset isnull
or empty).
-
findRangeBounds
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 y-interval if the dataset has one.- Returns:
- The range (
null
if the dataset isnull
or empty). - Since:
- 1.0.13
-
getItemMiddle
public double getItemMiddle(Comparable rowKey, Comparable columnKey, CategoryDataset dataset, CategoryAxis axis, Rectangle2D area, org.jfree.ui.RectangleEdge edge) Returns the Java2D coordinate for the middle of the specified data item.- Specified by:
getItemMiddle
in interfaceCategoryItemRenderer
- Parameters:
rowKey
- the row key.columnKey
- the column key.dataset
- the dataset.axis
- the axis.area
- the data area.edge
- the edge along which the axis lies.- Returns:
- The Java2D coordinate for the middle of the item.
- Since:
- 1.0.11
-
drawBackground
Draws a background for the data area. The default implementation just gets the plot to draw the background, but some renderers will override this behaviour.- Specified by:
drawBackground
in interfaceCategoryItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.dataArea
- the data area.
-
drawOutline
Draws an outline for the data area. The default implementation just gets the plot to draw the outline, but some renderers will override this behaviour.- Specified by:
drawOutline
in interfaceCategoryItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.dataArea
- the data area.
-
drawDomainGridline
public void drawDomainGridline(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, double value) Draws a grid line against the domain axis.Note that this default implementation assumes that the horizontal axis is the domain axis. If this is not the case, you will need to override this method.
- Specified by:
drawDomainGridline
in interfaceCategoryItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.dataArea
- the area for plotting data (not yet adjusted for any 3D effect).value
- the Java2D value at which the grid line should be drawn.- See Also:
-
drawRangeGridline
public void drawRangeGridline(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Rectangle2D dataArea, double value) Draws a grid line against the range axis.- Specified by:
drawRangeGridline
in interfaceCategoryItemRenderer
- 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.- See Also:
-
drawRangeLine
public void drawRangeLine(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) Draws a line perpendicular to the range axis.- 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.paint
- the paint (null
not permitted).stroke
- the stroke (null
not permitted).- Since:
- 1.0.13
- See Also:
-
drawDomainMarker
public void drawDomainMarker(Graphics2D g2, CategoryPlot plot, CategoryAxis axis, CategoryMarker marker, Rectangle2D dataArea) Draws a marker for the domain axis.- Specified by:
drawDomainMarker
in interfaceCategoryItemRenderer
- Parameters:
g2
- the graphics device (notnull
).plot
- the plot (notnull
).axis
- the range axis (notnull
).marker
- the marker to be drawn (notnull
).dataArea
- the area inside the axes (notnull
).- See Also:
-
drawRangeMarker
public void drawRangeMarker(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, Rectangle2D dataArea) Draws a marker for the range axis.- Specified by:
drawRangeMarker
in interfaceCategoryItemRenderer
- Parameters:
g2
- the graphics device (notnull
).plot
- the plot (notnull
).axis
- the range axis (notnull
).marker
- the marker to be drawn (notnull
).dataArea
- the area inside the axes (notnull
).- See Also:
-
calculateDomainMarkerTextAnchorPoint
protected Point2D calculateDomainMarkerTextAnchorPoint(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, org.jfree.ui.RectangleInsets markerOffset, org.jfree.ui.LengthAdjustmentType labelOffsetType, org.jfree.ui.RectangleAnchor anchor) Calculates the (x, y) coordinates for drawing the label for a marker on the range axis.- Parameters:
g2
- the graphics device.orientation
- the plot orientation.dataArea
- the data area.markerArea
- the rectangle surrounding the marker.markerOffset
- the marker offset.labelOffsetType
- the label offset type.anchor
- the label anchor.- Returns:
- The coordinates for drawing the marker label.
-
calculateRangeMarkerTextAnchorPoint
protected Point2D calculateRangeMarkerTextAnchorPoint(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, org.jfree.ui.RectangleInsets markerOffset, org.jfree.ui.LengthAdjustmentType labelOffsetType, org.jfree.ui.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.markerOffset
- the marker offset.labelOffsetType
- the label offset type.anchor
- the label anchor.- Returns:
- The coordinates for drawing the marker label.
-
getLegendItem
Returns a legend item for a series. This default implementation will returnnull
ifAbstractRenderer.isSeriesVisible(int)
orAbstractRenderer.isSeriesVisibleInLegend(int)
returnsfalse
.- Specified by:
getLegendItem
in interfaceCategoryItemRenderer
- Parameters:
datasetIndex
- the dataset index (zero-based).series
- the series index (zero-based).- Returns:
- The legend item (possibly
null
). - See Also:
-
equals
Tests this renderer for equality with another object.- Overrides:
equals
in classAbstractRenderer
- Parameters:
obj
- the object.- Returns:
true
orfalse
.
-
hashCode
public int hashCode()Returns a hash code for the renderer.- Overrides:
hashCode
in classAbstractRenderer
- Returns:
- The hash code.
-
getDrawingSupplier
Returns the drawing supplier from the plot.- Specified by:
getDrawingSupplier
in classAbstractRenderer
- Returns:
- The drawing supplier (possibly
null
).
-
updateCrosshairValues
protected void updateCrosshairValues(CategoryCrosshairState crosshairState, Comparable rowKey, Comparable columnKey, double value, 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).rowKey
- the row key.columnKey
- the column key.value
- the data value.datasetIndex
- the dataset index.transX
- the x-value translated to Java2D space.transY
- the y-value translated to Java2D space.orientation
- the plot orientation (null
not permitted).- Since:
- 1.0.11
-
drawItemLabel
protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, double x, double y, boolean negative) Draws an item label.- Parameters:
g2
- the graphics device.orientation
- the orientation.dataset
- the dataset.row
- the row.column
- the column.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).
-
clone
Returns an independent copy of the renderer. Theplot
reference is shallow copied.- Specified by:
clone
in interfaceorg.jfree.util.PublicCloneable
- Overrides:
clone
in classAbstractRenderer
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- can be thrown if one of the objects belonging to the renderer does not support cloning (for example, an item label generator).
-
getDomainAxis
Returns a domain axis for a plot.- Parameters:
plot
- the plot.index
- the axis index.- Returns:
- A domain axis.
-
getRangeAxis
Returns a range axis for a plot.- Parameters:
plot
- the plot.index
- the axis index.- Returns:
- A range axis.
-
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
). - See Also:
-
getLegendItemLabelGenerator
Returns the legend item label generator.- Returns:
- The label generator (never
null
). - See Also:
-
setLegendItemLabelGenerator
Sets the legend item label generator and sends aRendererChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
not 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 aRendererChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- 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 aRendererChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- See Also:
-
addItemEntity
protected void addItemEntity(EntityCollection entities, CategoryDataset dataset, int row, int column, Shape hotspot) Adds an entity with the specified hotspot.- Parameters:
entities
- the entity collection.dataset
- the dataset.row
- the row index.column
- the column index.hotspot
- the hotspot (null
not permitted).
-
addEntity
protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, double entityX, double entityY) Adds an entity to the collection.- Parameters:
entities
- the entity collection being populated.hotspot
- the entity area (ifnull
a default will be used).dataset
- the dataset.row
- the series.column
- the item.entityX
- the entity's center x-coordinate in user space (only used ifarea
isnull
).entityY
- the entity's center y-coordinate in user space (only used ifarea
isnull
).- Since:
- 1.0.13
-
setItemLabelGenerator
Deprecated.This method should no longer be used (as of version 1.0.6). It is sufficient to rely onsetSeriesItemLabelGenerator(int, CategoryItemLabelGenerator)
andsetBaseItemLabelGenerator(CategoryItemLabelGenerator)
.Sets the item label generator for ALL series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setItemLabelGenerator
in interfaceCategoryItemRenderer
- Parameters:
generator
- the generator (null
permitted).
-
getToolTipGenerator
Deprecated.This method should no longer be used (as of version 1.0.6). It is sufficient to rely ongetSeriesToolTipGenerator(int)
andgetBaseToolTipGenerator()
.Returns the tool tip generator that will be used for ALL items in the dataset (the "layer 0" generator).- Specified by:
getToolTipGenerator
in interfaceCategoryItemRenderer
- Returns:
- A tool tip generator (possibly
null
). - See Also:
-
setToolTipGenerator
Deprecated.This method should no longer be used (as of version 1.0.6). It is sufficient to rely onsetSeriesToolTipGenerator(int, CategoryToolTipGenerator)
andsetBaseToolTipGenerator(CategoryToolTipGenerator)
.Sets the tool tip generator for ALL series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setToolTipGenerator
in interfaceCategoryItemRenderer
- Parameters:
generator
- the generator (null
permitted).- See Also:
-
setItemURLGenerator
Deprecated.This method should no longer be used (as of version 1.0.6). It is sufficient to rely onsetSeriesItemURLGenerator(int, CategoryURLGenerator)
andsetBaseItemURLGenerator(CategoryURLGenerator)
.Sets the item URL generator for ALL series and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setItemURLGenerator
in interfaceCategoryItemRenderer
- Parameters:
generator
- the generator.- See Also:
-