Package org.jfree.chart.renderer
Class DefaultPolarItemRenderer
- java.lang.Object
-
- org.jfree.chart.renderer.AbstractRenderer
-
- org.jfree.chart.renderer.DefaultPolarItemRenderer
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,PolarItemRenderer
public class DefaultPolarItemRenderer extends AbstractRenderer implements PolarItemRenderer
A renderer that can be used with thePolarPlot
class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private XYToolTipGenerator
baseToolTipGenerator
The base tool tip generator.private boolean
connectFirstAndLastPoint
Flag that controls if the first and last point of the dataset should be connected or not.private boolean
drawOutlineWhenFilled
Flag that controls whether an outline is drawn for filled series or not.private java.awt.Composite
fillComposite
The composite to use when filling series.private XYSeriesLabelGenerator
legendItemToolTipGenerator
The legend item tool tip generator.private XYSeriesLabelGenerator
legendItemURLGenerator
The legend item URL generator.private java.awt.Shape
legendLine
The shape that is used to represent a line in the legend.private PolarPlot
plot
The plot that the renderer is assigned to.private BooleanList
seriesFilled
Flags that control whether the renderer fills each series or not.private boolean
shapesVisible
Flag that controls whether item shapes are visible or not.private ObjectList
toolTipGeneratorList
A list of tool tip generators (one per series).private XYURLGenerator
urlGenerator
The URL text generator.private boolean
useFillPaint
A flag that controls whether the fill paint is used for filling shapes.-
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 Constructor Description DefaultPolarItemRenderer()
Creates a new instance of DefaultPolarItemRenderer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addEntity(EntityCollection entities, java.awt.Shape area, XYDataset dataset, int series, int item, double entityX, double entityY)
Adds an entity to the collection.java.lang.Object
clone()
Returns a clone of the renderer.void
drawAngularGridLines(java.awt.Graphics2D g2, PolarPlot plot, java.util.List ticks, java.awt.geom.Rectangle2D dataArea)
Draw the angular gridlines - the spokes.void
drawRadialGridLines(java.awt.Graphics2D g2, PolarPlot plot, ValueAxis radialAxis, java.util.List ticks, java.awt.geom.Rectangle2D dataArea)
Draw the radial gridlines - the rings.void
drawSeries(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex)
Plots the data for a given series.boolean
equals(java.lang.Object obj)
Tests this renderer for equality with an arbitrary object.XYToolTipGenerator
getBaseToolTipGenerator()
Returns the default tool tip generator.boolean
getConnectFirstAndLastPoint()
Returnstrue
if first and last point of a series will be connected,false
otherwise.DrawingSupplier
getDrawingSupplier()
Returns the drawing supplier from the plot.boolean
getDrawOutlineWhenFilled()
Returnstrue
if the renderer will draw an outline around a filled polygon,false
otherwise.java.awt.Composite
getFillComposite()
Get the composite that is used for filling.LegendItem
getLegendItem(int series)
Return the legend for the given series.XYSeriesLabelGenerator
getLegendItemToolTipGenerator()
Returns the legend item tool tip generator.XYSeriesLabelGenerator
getLegendItemURLGenerator()
Returns the legend item URL generator.java.awt.Shape
getLegendLine()
Returns the shape used to represent a line in the legend.PolarPlot
getPlot()
Return the plot associated with this renderer.XYToolTipGenerator
getSeriesToolTipGenerator(int series)
Returns the tool tip generator for the specified series.boolean
getShapesVisible()
Returnstrue
if a shape will be drawn for every item, orfalse
if not.XYToolTipGenerator
getToolTipGenerator(int series, int item)
Returns the tooltip generator for the specified series and item.XYURLGenerator
getURLGenerator()
Returns the URL generator.boolean
getUseFillPaint()
Returnstrue
if the renderer should use the fill paint setting to fill shapes, andfalse
if it should just use the regular paint.boolean
isSeriesFilled(int series)
Returnstrue
if the renderer should fill the specified series, andfalse
otherwise.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.void
setBaseToolTipGenerator(XYToolTipGenerator generator)
Sets the default tool tip generator and sends aRendererChangeEvent
to all registered listeners.void
setConnectFirstAndLastPoint(boolean connect)
Set the flag that controls whether the first and last point of a series will be connected or not and sends aRendererChangeEvent
to all registered listeners.void
setDrawOutlineWhenFilled(boolean drawOutlineWhenFilled)
Set the flag that controls whether the outline around a filled polygon will be drawn or not and sends aRendererChangeEvent
to all registered listeners.void
setFillComposite(java.awt.Composite composite)
Sets the composite which will be used for filling polygons 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
setLegendLine(java.awt.Shape line)
Sets the shape used as a line in each legend item and sends aRendererChangeEvent
to all registered listeners.void
setPlot(PolarPlot plot)
Set the plot associated with this renderer.void
setSeriesFilled(int series, boolean filled)
Sets a flag that controls whether or not a series is filled.void
setSeriesToolTipGenerator(int series, XYToolTipGenerator generator)
Sets the tooltip generator for the specified series.void
setShapesVisible(boolean visible)
Set the flag that controls whether a shape will be drawn for every item, or not and sends aRendererChangeEvent
to all registered listeners.void
setURLGenerator(XYURLGenerator urlGenerator)
Sets the URL generator.void
setUseFillPaint(boolean flag)
Sets the flag that controls whether the fill paint is used to fill shapes, and sends aRendererChangeEvent
to all registered listeners.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.-
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, hashCode, 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.PolarItemRenderer
addChangeListener, removeChangeListener
-
-
-
-
Field Detail
-
plot
private PolarPlot plot
The plot that the renderer is assigned to.
-
seriesFilled
private BooleanList seriesFilled
Flags that control whether the renderer fills each series or not.
-
drawOutlineWhenFilled
private boolean drawOutlineWhenFilled
Flag that controls whether an outline is drawn for filled series or not.
-
fillComposite
private transient java.awt.Composite fillComposite
The composite to use when filling series.
-
useFillPaint
private boolean useFillPaint
A flag that controls whether the fill paint is used for filling shapes.
-
legendLine
private transient java.awt.Shape legendLine
The shape that is used to represent a line in the legend.
-
shapesVisible
private boolean shapesVisible
Flag that controls whether item shapes are visible or not.
-
connectFirstAndLastPoint
private boolean connectFirstAndLastPoint
Flag that controls if the first and last point of the dataset should be connected or not.
-
toolTipGeneratorList
private ObjectList toolTipGeneratorList
A list of tool tip generators (one per series).
-
baseToolTipGenerator
private XYToolTipGenerator baseToolTipGenerator
The base tool tip generator.
-
urlGenerator
private XYURLGenerator urlGenerator
The URL text generator.
-
legendItemToolTipGenerator
private XYSeriesLabelGenerator legendItemToolTipGenerator
The legend item tool tip generator.
-
legendItemURLGenerator
private XYSeriesLabelGenerator legendItemURLGenerator
The legend item URL generator.
-
-
Method Detail
-
setPlot
public void setPlot(PolarPlot plot)
Set the plot associated with this renderer.- Specified by:
setPlot
in interfacePolarItemRenderer
- Parameters:
plot
- the plot.- See Also:
getPlot()
-
getPlot
public PolarPlot getPlot()
Return the plot associated with this renderer.- Specified by:
getPlot
in interfacePolarItemRenderer
- Returns:
- The plot.
- See Also:
setPlot(PolarPlot)
-
getDrawOutlineWhenFilled
public boolean getDrawOutlineWhenFilled()
Returnstrue
if the renderer will draw an outline around a filled polygon,false
otherwise.- Returns:
- A boolean.
-
setDrawOutlineWhenFilled
public void setDrawOutlineWhenFilled(boolean drawOutlineWhenFilled)
Set the flag that controls whether the outline around a filled polygon will be drawn or not and sends aRendererChangeEvent
to all registered listeners.- Parameters:
drawOutlineWhenFilled
- the flag.
-
getFillComposite
public java.awt.Composite getFillComposite()
Get the composite that is used for filling.- Returns:
- The composite (never
null
).
-
setFillComposite
public void setFillComposite(java.awt.Composite composite)
Sets the composite which will be used for filling polygons and sends aRendererChangeEvent
to all registered listeners.- Parameters:
composite
- the composite to use (null
not permitted).
-
getShapesVisible
public boolean getShapesVisible()
Returnstrue
if a shape will be drawn for every item, orfalse
if not.- Returns:
- A boolean.
-
setShapesVisible
public void setShapesVisible(boolean visible)
Set the flag that controls whether a shape will be drawn for every item, or not and sends aRendererChangeEvent
to all registered listeners.- Parameters:
visible
- the flag.
-
getConnectFirstAndLastPoint
public boolean getConnectFirstAndLastPoint()
Returnstrue
if first and last point of a series will be connected,false
otherwise.- Returns:
- The current status of the flag.
-
setConnectFirstAndLastPoint
public void setConnectFirstAndLastPoint(boolean connect)
Set the flag that controls whether the first and last point of a series will be connected or not and sends aRendererChangeEvent
to all registered listeners.- Parameters:
connect
- the flag.
-
getDrawingSupplier
public DrawingSupplier getDrawingSupplier()
Returns the drawing supplier from the plot.- Specified by:
getDrawingSupplier
in classAbstractRenderer
- Returns:
- The drawing supplier.
-
isSeriesFilled
public boolean isSeriesFilled(int series)
Returnstrue
if the renderer should fill the specified series, andfalse
otherwise.- Parameters:
series
- the series index (zero-based).- Returns:
- A boolean.
-
setSeriesFilled
public void setSeriesFilled(int series, boolean filled)
Sets a flag that controls whether or not a series is filled.- Parameters:
series
- the series index.filled
- the flag.
-
getUseFillPaint
public boolean getUseFillPaint()
Returnstrue
if the renderer should use the fill paint setting to fill shapes, andfalse
if it should just use the regular paint.- Returns:
- A boolean.
- See Also:
setUseFillPaint(boolean)
-
setUseFillPaint
public void setUseFillPaint(boolean flag)
Sets the flag that controls whether the fill paint is used to fill shapes, and sends aRendererChangeEvent
to all registered listeners.- Parameters:
flag
- the flag.- See Also:
getUseFillPaint()
-
getLegendLine
public java.awt.Shape getLegendLine()
Returns the shape used to represent a line in the legend.- Returns:
- The legend line (never
null
). - See Also:
setLegendLine(Shape)
-
setLegendLine
public void setLegendLine(java.awt.Shape line)
Sets the shape used as a line in each legend item and sends aRendererChangeEvent
to all registered listeners.- Parameters:
line
- the line (null
not permitted).- See Also:
getLegendLine()
-
addEntity
protected void addEntity(EntityCollection entities, java.awt.Shape area, XYDataset dataset, int series, int item, double entityX, double entityY)
Adds an entity to the collection.- Parameters:
entities
- the entity collection being populated.area
- the entity area (ifnull
a default will be used).dataset
- the dataset.series
- the series.item
- 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
).
-
drawSeries
public void drawSeries(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex)
Plots the data for a given series.- Specified by:
drawSeries
in interfacePolarItemRenderer
- Parameters:
g2
- the drawing surface.dataArea
- the data area.info
- collects plot rendering info.plot
- the plot.dataset
- the dataset.seriesIndex
- the series index.
-
drawAngularGridLines
public void drawAngularGridLines(java.awt.Graphics2D g2, PolarPlot plot, java.util.List ticks, java.awt.geom.Rectangle2D dataArea)
Draw the angular gridlines - the spokes.- Specified by:
drawAngularGridLines
in interfacePolarItemRenderer
- Parameters:
g2
- the drawing surface.plot
- the plot (null
not permitted).ticks
- the ticks (null
not permitted).dataArea
- the data area.
-
drawRadialGridLines
public void drawRadialGridLines(java.awt.Graphics2D g2, PolarPlot plot, ValueAxis radialAxis, java.util.List ticks, java.awt.geom.Rectangle2D dataArea)
Draw the radial gridlines - the rings.- Specified by:
drawRadialGridLines
in interfacePolarItemRenderer
- Parameters:
g2
- the drawing surface (null
not permitted).plot
- the plot (null
not permitted).radialAxis
- the radial axis (null
not permitted).ticks
- the ticks (null
not permitted).dataArea
- the data area.
-
getLegendItem
public LegendItem getLegendItem(int series)
Return the legend for the given series.- Specified by:
getLegendItem
in interfacePolarItemRenderer
- Parameters:
series
- the series index.- Returns:
- The legend item.
-
getToolTipGenerator
public XYToolTipGenerator getToolTipGenerator(int series, int item)
Returns the tooltip generator for the specified series and item.- Specified by:
getToolTipGenerator
in interfacePolarItemRenderer
- Parameters:
series
- the series index.item
- the item index.- Returns:
- The tooltip generator (possibly
null
).
-
getSeriesToolTipGenerator
public XYToolTipGenerator getSeriesToolTipGenerator(int series)
Returns the tool tip generator for the specified series.- Specified by:
getSeriesToolTipGenerator
in interfacePolarItemRenderer
- Parameters:
series
- the series index (zero based).- Returns:
- The tooltip generator (possibly
null
). - See Also:
PolarItemRenderer.setSeriesToolTipGenerator(int, XYToolTipGenerator)
-
setSeriesToolTipGenerator
public void setSeriesToolTipGenerator(int series, XYToolTipGenerator generator)
Sets the tooltip generator for the specified series.- Specified by:
setSeriesToolTipGenerator
in interfacePolarItemRenderer
- Parameters:
series
- the series index.generator
- the tool tip generator (null
permitted).- See Also:
PolarItemRenderer.getSeriesToolTipGenerator(int)
-
getBaseToolTipGenerator
public XYToolTipGenerator getBaseToolTipGenerator()
Returns the default tool tip generator.- Specified by:
getBaseToolTipGenerator
in interfacePolarItemRenderer
- Returns:
- The default tool tip generator (possibly
null
). - See Also:
PolarItemRenderer.setBaseToolTipGenerator(XYToolTipGenerator)
-
setBaseToolTipGenerator
public void setBaseToolTipGenerator(XYToolTipGenerator generator)
Sets the default tool tip generator and sends aRendererChangeEvent
to all registered listeners.- Specified by:
setBaseToolTipGenerator
in interfacePolarItemRenderer
- Parameters:
generator
- the generator (null
permitted).- See Also:
PolarItemRenderer.getBaseToolTipGenerator()
-
getURLGenerator
public XYURLGenerator getURLGenerator()
Returns the URL generator.- Specified by:
getURLGenerator
in interfacePolarItemRenderer
- Returns:
- The URL generator (possibly
null
).
-
setURLGenerator
public void setURLGenerator(XYURLGenerator urlGenerator)
Sets the URL generator.- Specified by:
setURLGenerator
in interfacePolarItemRenderer
- Parameters:
urlGenerator
- the generator (null
permitted)
-
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()
-
equals
public boolean equals(java.lang.Object obj)
Tests this renderer for equality with an arbitrary object.- Overrides:
equals
in classAbstractRenderer
- Parameters:
obj
- the object (null
not permitted).- Returns:
true
if this renderer is equal toobj
, andfalse
otherwise.
-
clone
public 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 cannot be cloned.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
-