public class XYShapeRenderer extends AbstractXYItemRenderer implements XYItemRenderer, Cloneable, Serializable
XYZDataset
, fills the shapes with a paint that
is based on the z-value (the paint is obtained from a lookup table). The
renderer also allows for optional guidelines, horizontal and vertical lines
connecting the shape to the edges of the plot.
XYShapeRendererDemo1.java
program included in the JFreeChart
demo collection:
XYLineAndShapeRenderer
.DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO
Constructor and Description |
---|
XYShapeRenderer()
Creates a new
XYShapeRenderer instance with default
attributes. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a clone of this renderer.
|
void |
drawItem(Graphics2D g2,
XYItemRendererState state,
Rectangle2D dataArea,
PlotRenderingInfo info,
XYPlot plot,
ValueAxis domainAxis,
ValueAxis rangeAxis,
XYDataset dataset,
int series,
int item,
CrosshairState crosshairState,
int pass)
Draws the block representing the specified item.
|
boolean |
equals(Object obj)
Tests this instance for equality with an arbitrary object.
|
Range |
findDomainBounds(XYDataset dataset)
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.
|
Range |
findZBounds(XYZDataset dataset)
Return the range of z-values in the specified dataset.
|
boolean |
getDrawOutlines()
Returns
true if outlines should be drawn for shapes, and
false otherwise. |
Paint |
getGuideLinePaint()
Returns the paint used to draw the guide lines.
|
Stroke |
getGuideLineStroke()
Returns the stroke used to draw the guide lines.
|
PaintScale |
getPaintScale()
Returns the paint scale used by the renderer.
|
int |
getPassCount()
Returns the number of passes required by this renderer.
|
boolean |
getUseFillPaint()
Returns
true if the renderer should use the fill paint
setting to fill shapes, and false if it should just
use the regular paint. |
boolean |
getUseOutlinePaint()
Returns the flag that controls whether the outline paint is used for
shape outlines.
|
boolean |
isGuideLinesVisible()
Returns a flag that controls whether or not guide lines are drawn for
each data item (the lines are horizontal and vertical "crosshairs"
linking the data point to the axes).
|
void |
setDrawOutlines(boolean flag)
Sets the flag that controls whether outlines are drawn for
shapes, and sends a
RendererChangeEvent to all registered
listeners. |
void |
setGuideLinePaint(Paint paint)
Sets the paint used to draw the guide lines and sends a
RendererChangeEvent to all registered listeners. |
void |
setGuideLineStroke(Stroke stroke)
Sets the stroke used to draw the guide lines and sends a
RendererChangeEvent to all registered listeners. |
void |
setGuideLinesVisible(boolean visible)
Sets the flag that controls whether or not guide lines are drawn for
each data item and sends a
RendererChangeEvent to all registered
listeners. |
void |
setPaintScale(PaintScale scale)
Sets the paint scale used by the renderer and sends a
RendererChangeEvent to all registered listeners. |
void |
setUseFillPaint(boolean flag)
Sets the flag that controls whether the fill paint is used to fill
shapes, and sends a
RendererChangeEvent to all
registered listeners. |
void |
setUseOutlinePaint(boolean use)
Sets the flag that controls whether the outline paint is used for shape
outlines, and sends a
RendererChangeEvent to all registered
listeners. |
addAnnotation, addAnnotation, annotationChanged, drawAnnotations, drawDomainGridLine, drawDomainLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, getAnnotations, getBaseItemLabelGenerator, getBaseToolTipGenerator, getDrawingSupplier, getItemLabelGenerator, getItemLabelGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, getURLGenerator, initialise, isPointInRect, removeAnnotation, removeAnnotations, setBaseItemLabelGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setToolTipGenerator, setURLGenerator
addChangeListener, clearSeriesPaints, clearSeriesStrokes, 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, hashCode, 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
getClass, notify, notifyAll, toString, wait, wait, wait
addAnnotation, addAnnotation, addChangeListener, drawAnnotations, drawDomainGridLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, getBaseItemLabelFont, getBaseItemLabelGenerator, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getBaseToolTipGenerator, getItemLabelFont, getItemLabelFont, getItemLabelGenerator, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendItem, getLegendItemLabelGenerator, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPlot, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelGenerator, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesToolTipGenerator, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, getToolTipGenerator, getURLGenerator, initialise, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeAnnotation, removeAnnotations, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelGenerator, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseStroke, setBaseToolTipGenerator, setItemLabelFont, setItemLabelGenerator, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setLegendItemLabelGenerator, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlineStroke, setPaint, setPlot, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesItemLabelFont, setSeriesItemLabelGenerator, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesStroke, setSeriesToolTipGenerator, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setStroke, setToolTipGenerator, setURLGenerator
getLegendItems
public XYShapeRenderer()
XYShapeRenderer
instance with default
attributes.public PaintScale getPaintScale()
null
).setPaintScale(PaintScale)
public void setPaintScale(PaintScale scale)
RendererChangeEvent
to all registered listeners.scale
- the scale (null
not permitted).getPaintScale()
public boolean getDrawOutlines()
true
if outlines should be drawn for shapes, and
false
otherwise.setDrawOutlines(boolean)
public void setDrawOutlines(boolean flag)
RendererChangeEvent
to all registered
listeners.
In some cases, shapes look better if they do NOT have an outline, but this flag allows you to set your own preference.
flag
- the flag.getDrawOutlines()
public boolean getUseFillPaint()
true
if the renderer should use the fill paint
setting to fill shapes, and false
if it should just
use the regular paint.
Refer to XYLineAndShapeRendererDemo2.java
to see the
effect of this flag.
setUseFillPaint(boolean)
,
getUseOutlinePaint()
public void setUseFillPaint(boolean flag)
RendererChangeEvent
to all
registered listeners.flag
- the flag.getUseFillPaint()
public boolean getUseOutlinePaint()
setUseOutlinePaint(boolean)
public void setUseOutlinePaint(boolean use)
RendererChangeEvent
to all registered
listeners.use
- the flag.getUseOutlinePaint()
public boolean isGuideLinesVisible()
setGuideLinesVisible(boolean)
public void setGuideLinesVisible(boolean visible)
RendererChangeEvent
to all registered
listeners.visible
- the new flag value.isGuideLinesVisible()
public Paint getGuideLinePaint()
null
).setGuideLinePaint(Paint)
public void setGuideLinePaint(Paint paint)
RendererChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getGuideLinePaint()
public Stroke getGuideLineStroke()
setGuideLineStroke(Stroke)
public void setGuideLineStroke(Stroke stroke)
RendererChangeEvent
to all registered listeners.stroke
- the stroke (null
not permitted).getGuideLineStroke()
public Range findDomainBounds(XYDataset dataset)
findDomainBounds
in interface XYItemRenderer
findDomainBounds
in class AbstractXYItemRenderer
dataset
- the dataset (null
permitted).null
if the dataset is null
or empty).AbstractXYItemRenderer.findRangeBounds(XYDataset)
public Range findRangeBounds(XYDataset dataset)
findRangeBounds
in interface XYItemRenderer
findRangeBounds
in class AbstractXYItemRenderer
dataset
- the dataset (null
permitted).null
if the dataset is null
or empty).AbstractXYItemRenderer.findDomainBounds(XYDataset)
public Range findZBounds(XYZDataset dataset)
dataset
- the dataset (null
permitted).null
if the dataset is null
or empty).public int getPassCount()
getPassCount
in interface XYItemRenderer
getPassCount
in class AbstractXYItemRenderer
2
.public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass)
drawItem
in interface XYItemRenderer
g2
- the graphics device.state
- the state.dataArea
- the data area.info
- the plot rendering info.plot
- the plot.domainAxis
- the x-axis.rangeAxis
- the y-axis.dataset
- the dataset.series
- the series index.item
- the item index.crosshairState
- the crosshair state.pass
- the pass index.public boolean equals(Object obj)
true
if and only if:
obj
is an instance of XYShapeRenderer
(not
null
);obj
has the same field values as this
XYShapeRenderer
;equals
in class AbstractXYItemRenderer
obj
- the object (null
permitted).public Object clone() throws CloneNotSupportedException
CloneNotSupportedException
- if there is a problem creating the
clone.Jas4pp 1.5 © Java Analysis Studio for Particle Physics