public class

LayeredBarRenderer

extends BarRenderer
implements Serializable
java.lang.Object
   ↳ org.jfree.chart.renderer.AbstractRenderer
     ↳ org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
       ↳ org.jfree.chart.renderer.category.BarRenderer
         ↳ org.jfree.chart.renderer.category.LayeredBarRenderer

Class Overview

A CategoryItemRenderer that represents data using bars which are superimposed. The example shown here is generated by the LayeredBarChartDemo1.java program included in the JFreeChart Demo Collection:

LayeredBarRendererSample.png

Summary

[Expand]
Inherited Constants
From class org.jfree.chart.renderer.category.BarRenderer
Fields
protected ObjectList seriesBarWidthList A list of the width of each series bar.
[Expand]
Inherited Fields
From class org.jfree.chart.renderer.AbstractRenderer
Public Constructors
LayeredBarRenderer()
Default constructor.
Public Methods
void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset data, int row, int column, int pass)
Draws the bar for one item in the dataset.
double getSeriesBarWidth(int series)
Returns the bar width for a series, or Double.NaN if no width has been set.
void setSeriesBarWidth(int series, double width)
Sets the width of the bars of a series.
Protected Methods
void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state)
Calculates the bar width and stores it in the renderer state.
void drawHorizontalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column)
Draws the bar for a single (series, category) data item.
void drawVerticalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column)
Draws the bar for a single (series, category) data item.
[Expand]
Inherited Methods
From class org.jfree.chart.renderer.category.BarRenderer
From class org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
From class org.jfree.chart.renderer.AbstractRenderer
From class java.lang.Object
From interface org.jfree.chart.LegendItemSource
From interface org.jfree.chart.renderer.category.CategoryItemRenderer

Fields

protected ObjectList seriesBarWidthList

A list of the width of each series bar.

Public Constructors

public LayeredBarRenderer ()

Default constructor.

Public Methods

public void drawItem (Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset data, int row, int column, int pass)

Draws the bar for one item in the dataset.

Parameters
g2 the graphics device.
state the renderer state.
dataArea the plot area.
plot the plot.
domainAxis the domain (category) axis.
rangeAxis the range (value) axis.
data the data.
row the row index (zero-based).
column the column index (zero-based).
pass the pass index.

public double getSeriesBarWidth (int series)

Returns the bar width for a series, or Double.NaN if no width has been set.

Parameters
series the series index (zero based).
Returns
  • The width for the series (1.0=100%, it is the maximum).

public void setSeriesBarWidth (int series, double width)

Sets the width of the bars of a series.

Parameters
series the series index (zero based).
width the width of the series bar in percentage (1.0=100%, it is the maximum).

Protected Methods

protected void calculateBarWidth (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.

protected void drawHorizontalItem (Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column)

Draws the bar for a single (series, category) data item.

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).

protected void drawVerticalItem (Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column)

Draws the bar for a single (series, category) data item.

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).