org.jfree.chart.renderer.xy

Class XYBlockRenderer

Implemented Interfaces:
Cloneable, LegendItemSource, Serializable, XYItemRenderer

public class XYBlockRenderer
extends AbstractXYItemRenderer
implements XYItemRenderer, Cloneable, Serializable

A renderer that represents data from an XYZDataset by drawing a color block at each (x, y) point, where the color is a function of the z-value from the dataset.
Since:
1.0.4

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

XYBlockRenderer()
Creates a new XYBlockRenderer instance with default attributes.

Method Summary

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 XYBlockRenderer 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.
RectangleAnchor
getBlockAnchor()
Returns the anchor point used to align a block at its (x, y) location.
double
getBlockHeight()
Returns the block height, in data/axis units.
double
getBlockWidth()
Returns the block width, in data/axis units.
PaintScale
getPaintScale()
Returns the paint scale used by the renderer.
void
setBlockAnchor(RectangleAnchor anchor)
Sets the anchor point used to align a block at its (x, y) location and sends a RendererChangeEvent to all registered listeners.
void
setBlockHeight(double height)
Sets the height of the blocks used to represent each data item.
void
setBlockWidth(double width)
Sets the width of the blocks used to represent each data item.
void
setPaintScale(PaintScale scale)
Sets the paint scale used by the renderer.

Methods inherited from class org.jfree.chart.renderer.xy.AbstractXYItemRenderer

addAnnotation, addAnnotation, addEntity, calculateDomainMarkerTextAnchorPoint, clone, drawAnnotations, drawDomainGridLine, drawDomainLine, drawDomainMarker, drawItemLabel, drawRangeLine, drawRangeMarker, equals, fillDomainGridBand, fillRangeGridBand, findDomainBounds, findRangeBounds, getBaseItemLabelGenerator, getBaseToolTipGenerator, getDefaultEntityRadius, getDrawingSupplier, getItemLabelGenerator, getItemLabelGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getLegendItems, getPassCount, getPlot, getSeriesItemLabelGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, getURLGenerator, initialise, removeAnnotation, removeAnnotations, setBaseItemLabelGenerator, setBaseToolTipGenerator, setDefaultEntityRadius, setItemLabelGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesToolTipGenerator, setToolTipGenerator, setURLGenerator, updateCrosshairValues, updateCrosshairValues

Methods inherited from class org.jfree.chart.renderer.AbstractRenderer

addChangeListener, calculateLabelAnchorPoint, clone, equals, fireChangeEvent, getBaseCreateEntities, getBaseFillPaint, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getCreateEntities, getDrawingSupplier, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, hasListener, hashCode, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, notifyListeners, removeChangeListener, setBaseCreateEntities, setBaseCreateEntities, setBaseFillPaint, setBaseFillPaint, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setCreateEntities, setCreateEntities, setFillPaint, setFillPaint, setItemLabelAnchorOffset, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, 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

Constructor Details

XYBlockRenderer

public XYBlockRenderer()
Creates a new XYBlockRenderer instance with default attributes.

Method Details

clone

public Object clone()
            throws CloneNotSupportedException
Returns a clone of this renderer.
Overrides:
clone in interface AbstractXYItemRenderer
Returns:
A clone of this renderer.

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:
drawItem in interface XYItemRenderer
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 this XYBlockRenderer for equality with an arbitrary object. This method returns true if and only if:
  • obj is an instance of XYBlockRenderer (not null);
  • obj has the same field values as this XYBlockRenderer;
Overrides:
equals in interface AbstractXYItemRenderer
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

findDomainBounds

public Range findDomainBounds(XYDataset dataset)
Returns the lower and upper bounds (range) of the x-values in the specified dataset.
Specified by:
findDomainBounds in interface XYItemRenderer
Overrides:
findDomainBounds in interface AbstractXYItemRenderer
Parameters:
dataset - the dataset (null permitted).
Returns:
The range (null if the dataset is null or empty).

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:
findRangeBounds in interface XYItemRenderer
Overrides:
findRangeBounds in interface AbstractXYItemRenderer
Parameters:
dataset - the dataset (null permitted).
Returns:
The range (null if the dataset is null or empty).

getBlockAnchor

public RectangleAnchor getBlockAnchor()
Returns the anchor point used to align a block at its (x, y) location. The default values is RectangleAnchor.CENTER.
Returns:
The anchor point (never null).

getBlockHeight

public double getBlockHeight()
Returns the block height, in data/axis units.
Returns:
The block height.

getBlockWidth

public double getBlockWidth()
Returns the block width, in data/axis units.
Returns:
The block width.

getPaintScale

public PaintScale getPaintScale()
Returns the paint scale used by the renderer.
Returns:
The paint scale (never null).
Since:
1.0.4

setBlockAnchor

public void setBlockAnchor(RectangleAnchor anchor)
Sets the anchor point used to align a block at its (x, y) location and sends a RendererChangeEvent to all registered listeners.
Parameters:
anchor - the anchor.

setBlockHeight

public void setBlockHeight(double height)
Sets the height of the blocks used to represent each data item.
Parameters:
height - the new height, in data/axis units (must be > 0.0).

setBlockWidth

public void setBlockWidth(double width)
Sets the width of the blocks used to represent each data item.
Parameters:
width - the new width, in data/axis units (must be > 0.0).

setPaintScale

public void setPaintScale(PaintScale scale)
Sets the paint scale used by the renderer.
Parameters:
scale - the scale (null not permitted).
Since:
1.0.4