org.jfree.chart.renderer.category

Class LevelRenderer

Implemented Interfaces:
Cloneable, PublicCloneable, Serializable, CategoryItemRenderer, LegendItemSource, Serializable

public class LevelRenderer
extends AbstractCategoryItemRenderer
implements Cloneable, PublicCloneable, Serializable

A CategoryItemRenderer that draws individual data items as horizontal lines, spaced in the same way as bars in a bar chart.

Field Summary

static double
DEFAULT_ITEM_MARGIN
The default item margin percentage.

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

LevelRenderer()
Creates a new renderer with default settings.

Method Summary

protected double
calculateBarW0(CategoryPlot plot, PlotOrientation orientation, Rectangle2D dataArea, CategoryAxis domainAxis, CategoryItemRendererState state, int row, int column)
Calculates the coordinate of the first "side" of a bar.
protected void
calculateItemWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state)
Calculates the bar width and stores it in the renderer state.
protected double
calculateSeriesWidth(double space, CategoryAxis axis, int categories, int series)
Calculates the available space for each series.
void
drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass)
Draws the bar for a single (series, category) data item.
boolean
equals(Object obj)
Tests an object for equality with this instance.
double
getItemMargin()
Returns the item margin.
double
getMaxItemWidth()
Deprecated. Use getMaximumItemWidth() instead.
double
getMaximumItemWidth()
Returns the maximum width, as a percentage of the available drawing space.
CategoryItemRendererState
initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info)
Initialises the renderer and returns a state object that will be passed to subsequent calls to the drawItem method.
void
setItemMargin(double percent)
Sets the item margin.
void
setMaxItemWidth(double percent)
Deprecated. Use setMaximumItemWidth(double) instead.
void
setMaximumItemWidth(double percent)
Sets the maximum item width, which is specified as a percentage of the available space for all items, and sends a RendererChangeEvent to all registered listeners.

Methods inherited from class org.jfree.chart.renderer.category.AbstractCategoryItemRenderer

addItemEntity, calculateDomainMarkerTextAnchorPoint, calculateRangeMarkerTextAnchorPoint, clone, createState, drawBackground, drawDomainGridline, drawDomainMarker, drawItemLabel, drawOutline, drawRangeGridline, drawRangeMarker, equals, findRangeBounds, getBaseItemLabelGenerator, getBaseItemURLGenerator, getBaseToolTipGenerator, getColumnCount, getDomainAxis, getDrawingSupplier, getItemLabelGenerator, getItemURLGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getLegendItems, getPassCount, getPlot, getRangeAxis, getRowCount, getSeriesItemLabelGenerator, getSeriesItemURLGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, hashCode, initialise, setBaseItemLabelGenerator, setBaseItemURLGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setItemURLGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesItemURLGenerator, setSeriesToolTipGenerator, setToolTipGenerator

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

Field Details

DEFAULT_ITEM_MARGIN

public static final double DEFAULT_ITEM_MARGIN
The default item margin percentage.
Field Value:
0.0

Constructor Details

LevelRenderer

public LevelRenderer()
Creates a new renderer with default settings.

Method Details

calculateBarW0

protected double calculateBarW0(CategoryPlot plot,
                                PlotOrientation orientation,
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column)
Calculates the coordinate of the first "side" of a bar. This will be the minimum x-coordinate for a vertical bar, and the minimum y-coordinate for a horizontal bar.
Parameters:
plot - the plot.
orientation - the plot orientation.
dataArea - the data area.
domainAxis - the domain axis.
state - the renderer state (has the bar width precalculated).
row - the row index.
column - the column index.
Returns:
The coordinate.

calculateItemWidth

protected void calculateItemWidth(CategoryPlot plot,
                                  Rectangle2D dataArea,
                                  int rendererIndex,
                                  CategoryItemRendererState state)
Calculates the bar width and stores it in the renderer state.
Parameters:
plot - the plot.
dataArea - the data area.
rendererIndex - the renderer index.
state - the renderer state.

calculateSeriesWidth

protected double calculateSeriesWidth(double space,
                                      CategoryAxis axis,
                                      int categories,
                                      int series)
Calculates the available space for each series.
Parameters:
space - the space along the entire axis (in Java2D units).
axis - the category axis.
categories - the number of categories.
series - the number of series.
Returns:
The width of one series.

drawItem

public void drawItem(Graphics2D g2,
                     CategoryItemRendererState state,
                     Rectangle2D dataArea,
                     CategoryPlot plot,
                     CategoryAxis domainAxis,
                     ValueAxis rangeAxis,
                     CategoryDataset dataset,
                     int row,
                     int column,
                     int pass)
Draws the bar for a single (series, category) data item.
Specified by:
drawItem in interface CategoryItemRenderer
Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the data area.
plot - the plot.
domainAxis - the domain axis.
rangeAxis - the range axis.
dataset - the dataset.
row - the row index (zero-based).
column - the column index (zero-based).
pass - the pass index.

equals

public boolean equals(Object obj)
Tests an object for equality with this instance.
Overrides:
equals in interface AbstractCategoryItemRenderer
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

getItemMargin

public double getItemMargin()
Returns the item margin.
Returns:
The margin.

getMaxItemWidth

public double getMaxItemWidth()

Deprecated. Use getMaximumItemWidth() instead.

Returns the maximum width, as a percentage of the available drawing space.
Returns:
The maximum width.

getMaximumItemWidth

public double getMaximumItemWidth()
Returns the maximum width, as a percentage of the available drawing space.
Returns:
The maximum width.

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 passed to subsequent calls to the drawItem method.

This method gets called once at the start of the process of drawing a chart.

Specified by:
initialise in interface CategoryItemRenderer
Overrides:
initialise in interface AbstractCategoryItemRenderer
Parameters:
g2 - the graphics device.
dataArea - the area in which the data is to be plotted.
plot - the plot.
rendererIndex - the renderer index.
info - collects chart rendering information for return to caller.
Returns:
The renderer state.

setItemMargin

public void setItemMargin(double percent)
Sets the item margin. The value is expressed as a percentage of the available width for plotting all the bars, with the resulting amount to be distributed between all the bars evenly.
Parameters:
percent - the new margin.

setMaxItemWidth

public void setMaxItemWidth(double percent)

Deprecated. Use setMaximumItemWidth(double) instead.

Sets the maximum item width, which is specified as a percentage of the available space for all items, and sends a RendererChangeEvent to all registered listeners.
Parameters:
percent - the percent.

setMaximumItemWidth

public void setMaximumItemWidth(double percent)
Sets the maximum item width, which is specified as a percentage of the available space for all items, and sends a RendererChangeEvent to all registered listeners.
Parameters:
percent - the percent.