- java.lang.Object
-
- org.jfree.chart.renderer.AbstractRenderer
-
- org.jfree.chart.renderer.xy.AbstractXYItemRenderer
-
- org.jfree.chart.renderer.xy.XYBlockRenderer
-
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,PublicCloneable,ChartElement,AnnotationChangeListener,org.jfree.chart.legend.LegendItemSource,XYItemRenderer
public class XYBlockRenderer extends AbstractXYItemRenderer implements XYItemRenderer, Cloneable, PublicCloneable, Serializable
A renderer that represents data from anXYZDatasetby drawing a color block at each (x, y) point, where the color is a function of the z-value from the dataset. The example shown here is generated by theXYBlockChartDemo1.javaprogram included in the JFreeChart demo collection:

- See Also:
- Serialized Form
-
-
Field Summary
-
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
Constructors Constructor Description XYBlockRenderer()Creates a newXYBlockRendererinstance with default attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Returns a clone of this renderer.voiddrawItem(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.booleanequals(Object obj)Tests thisXYBlockRendererfor equality with an arbitrary object.RangefindDomainBounds(XYDataset dataset)Returns the lower and upper bounds (range) of the x-values in the specified dataset.RangefindRangeBounds(XYDataset dataset)Returns the range of values the renderer requires to display all the items from the specified dataset.RectangleAnchorgetBlockAnchor()Returns the anchor point used to align a block at its (x, y) location.doublegetBlockHeight()Returns the block height, in data/axis units.doublegetBlockWidth()Returns the block width, in data/axis units.booleangetDrawOutlines()Returnstrueif outlines should be drawn for blocks, andfalseotherwise.PaintScalegetPaintScale()Returns the paint scale used by the renderer.booleangetUseOutlinePaint()Returnstrueif the renderer should use the outline paint setting to draw block outlines, andfalseif it should just use the regular item paint.voidsetBlockAnchor(RectangleAnchor anchor)Sets the anchor point used to align a block at its (x, y) location and sends aRendererChangeEventto all registered listeners.voidsetBlockHeight(double height)Sets the height of the blocks used to represent each data item and sends aRendererChangeEventto all registered listeners.voidsetBlockWidth(double width)Sets the width of the blocks used to represent each data item and sends aRendererChangeEventto all registered listeners.voidsetDrawOutlines(boolean flag)Sets the flag that controls whether outlines are drawn for blocks, and sends aRendererChangeEventto all registered listeners.voidsetPaintScale(PaintScale scale)Sets the paint scale used by the renderer and sends aRendererChangeEventto all registered listeners.voidsetUseOutlinePaint(boolean flag)Sets the flag that controls whether the outline paint is used to draw block outlines, and sends aRendererChangeEventto all registered listeners.-
Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer
addAnnotation, addAnnotation, addEntity, annotationChanged, beginElementGroup, calculateDomainMarkerTextAnchorPoint, drawAnnotations, drawDomainLine, drawDomainMarker, drawItemLabel, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, findDomainBounds, findRangeBounds, getAnnotations, getDefaultItemLabelGenerator, getDefaultToolTipGenerator, getDrawingSupplier, getItemLabelGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPassCount, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getURLGenerator, hashCode, initialise, lineTo, moveTo, removeAnnotation, removeAnnotations, setDefaultItemLabelGenerator, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setURLGenerator, updateCrosshairValues
-
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, 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, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, lookupLegendShape, lookupLegendTextFont, lookupLegendTextPaint, lookupSeriesFillPaint, lookupSeriesOutlinePaint, lookupSeriesOutlineStroke, lookupSeriesPaint, lookupSeriesShape, lookupSeriesStroke, notifyListeners, receive, removeChangeListener, setAutoPopulateSeriesFillPaint, setAutoPopulateSeriesOutlinePaint, setAutoPopulateSeriesOutlineStroke, setAutoPopulateSeriesPaint, setAutoPopulateSeriesShape, setAutoPopulateSeriesStroke, 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, 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.ChartElement
receive
-
Methods inherited from interface org.jfree.chart.renderer.xy.XYItemRenderer
addAnnotation, addAnnotation, addChangeListener, drawAnnotations, drawDomainLine, drawDomainMarker, drawRangeLine, drawRangeMarker, fillDomainGridBand, fillRangeGridBand, getAnnotations, getDefaultCreateEntities, getDefaultFillPaint, getDefaultItemLabelFont, getDefaultItemLabelGenerator, getDefaultItemLabelPaint, getDefaultItemLabelsVisible, getDefaultNegativeItemLabelPosition, getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultPositiveItemLabelPosition, getDefaultSeriesVisible, getDefaultSeriesVisibleInLegend, getDefaultShape, getDefaultStroke, getDefaultToolTipGenerator, getItemCreateEntity, getItemFillPaint, getItemLabelFont, getItemLabelGenerator, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendItem, getLegendItemLabelGenerator, getNegativeItemLabelPosition, getPassCount, getPlot, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelGenerator, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesToolTipGenerator, getSeriesVisible, getSeriesVisibleInLegend, getToolTipGenerator, getURLGenerator, initialise, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeAnnotation, removeAnnotations, removeChangeListener, setDefaultCreateEntities, setDefaultCreateEntities, setDefaultFillPaint, setDefaultFillPaint, setDefaultItemLabelFont, setDefaultItemLabelGenerator, setDefaultItemLabelPaint, setDefaultItemLabelsVisible, setDefaultItemLabelsVisible, setDefaultNegativeItemLabelPosition, setDefaultNegativeItemLabelPosition, setDefaultOutlinePaint, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultOutlineStroke, setDefaultPaint, setDefaultPaint, setDefaultPositiveItemLabelPosition, setDefaultPositiveItemLabelPosition, setDefaultSeriesVisible, setDefaultSeriesVisible, setDefaultSeriesVisibleInLegend, setDefaultSeriesVisibleInLegend, setDefaultShape, setDefaultShape, setDefaultStroke, setDefaultStroke, setDefaultToolTipGenerator, setLegendItemLabelGenerator, setPlot, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelGenerator, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesToolTipGenerator, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setURLGenerator
-
-
-
-
Constructor Detail
-
XYBlockRenderer
public XYBlockRenderer()
Creates a newXYBlockRendererinstance with default attributes.
-
-
Method Detail
-
getBlockWidth
public double getBlockWidth()
Returns the block width, in data/axis units.- Returns:
- The block width.
- See Also:
setBlockWidth(double)
-
setBlockWidth
public void setBlockWidth(double width)
Sets the width of the blocks used to represent each data item and sends aRendererChangeEventto all registered listeners.- Parameters:
width- the new width, in data/axis units (must be > 0.0).- See Also:
getBlockWidth()
-
getBlockHeight
public double getBlockHeight()
Returns the block height, in data/axis units.- Returns:
- The block height.
- See Also:
setBlockHeight(double)
-
setBlockHeight
public void setBlockHeight(double height)
Sets the height of the blocks used to represent each data item and sends aRendererChangeEventto all registered listeners.- Parameters:
height- the new height, in data/axis units (must be > 0.0).- See Also:
getBlockHeight()
-
getBlockAnchor
public RectangleAnchor getBlockAnchor()
Returns the anchor point used to align a block at its (x, y) location. The default values isRectangleAnchor.CENTER.- Returns:
- The anchor point (never
null). - See Also:
setBlockAnchor(RectangleAnchor)
-
setBlockAnchor
public void setBlockAnchor(RectangleAnchor anchor)
Sets the anchor point used to align a block at its (x, y) location and sends aRendererChangeEventto all registered listeners.- Parameters:
anchor- the anchor.- See Also:
getBlockAnchor()
-
getPaintScale
public PaintScale getPaintScale()
Returns the paint scale used by the renderer.- Returns:
- The paint scale (never
null). - See Also:
setPaintScale(PaintScale)
-
setPaintScale
public void setPaintScale(PaintScale scale)
Sets the paint scale used by the renderer and sends aRendererChangeEventto all registered listeners.- Parameters:
scale- the scale (nullnot permitted).- See Also:
getPaintScale()
-
getDrawOutlines
public boolean getDrawOutlines()
Returnstrueif outlines should be drawn for blocks, andfalseotherwise. The default value istrue.- Returns:
- A boolean.
- See Also:
setDrawOutlines(boolean)
-
setDrawOutlines
public void setDrawOutlines(boolean flag)
Sets the flag that controls whether outlines are drawn for blocks, and sends aRendererChangeEventto all registered listeners.- Parameters:
flag- the flag.- See Also:
getDrawOutlines()
-
getUseOutlinePaint
public boolean getUseOutlinePaint()
Returnstrueif the renderer should use the outline paint setting to draw block outlines, andfalseif it should just use the regular item paint.- Returns:
- A boolean.
- See Also:
setUseOutlinePaint(boolean)
-
setUseOutlinePaint
public void setUseOutlinePaint(boolean flag)
Sets the flag that controls whether the outline paint is used to draw block outlines, and sends aRendererChangeEventto all registered listeners.- Parameters:
flag- the flag.- See Also:
getUseOutlinePaint()
-
findDomainBounds
public Range findDomainBounds(XYDataset dataset)
Returns the lower and upper bounds (range) of the x-values in the specified dataset.- Specified by:
findDomainBoundsin interfaceXYItemRenderer- Overrides:
findDomainBoundsin classAbstractXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (
nullif the dataset isnullor empty). - See Also:
findRangeBounds(XYDataset)
-
findRangeBounds
public Range findRangeBounds(XYDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.- Specified by:
findRangeBoundsin interfaceXYItemRenderer- Overrides:
findRangeBoundsin classAbstractXYItemRenderer- Parameters:
dataset- the dataset (nullpermitted).- Returns:
- The range (
nullif the dataset isnullor empty). - See Also:
findDomainBounds(XYDataset)
-
drawItem
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)
Draws the block representing the specified item.- Specified by:
drawItemin interfaceXYItemRenderer- Parameters:
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.
-
equals
public boolean equals(Object obj)
Tests thisXYBlockRendererfor equality with an arbitrary object. This method returnstrueif and only if:objis an instance ofXYBlockRenderer(notnull);objhas the same field values as thisXYBlockRenderer;
- Overrides:
equalsin classAbstractXYItemRenderer- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of this renderer.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractXYItemRenderer- Returns:
- A clone of this renderer.
- Throws:
CloneNotSupportedException- if there is a problem creating the clone.
-
-