public class

CategoryStepRenderer

extends AbstractCategoryItemRenderer
implements Serializable Cloneable
java.lang.Object
   ↳ org.jfree.chart.renderer.AbstractRenderer
     ↳ org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
       ↳ org.jfree.chart.renderer.category.CategoryStepRenderer

Class Overview

A "step" renderer similar to XYStepRenderer but that can be used with the CategoryPlot class. The example shown here is generated by the CategoryStepChartDemo1.java program included in the JFreeChart Demo Collection:

CategoryStepRendererSample.png

Summary

Nested Classes
class CategoryStepRenderer.State State information for the renderer. 
Constants
int STAGGER_WIDTH The stagger width.
[Expand]
Inherited Fields
From class org.jfree.chart.renderer.AbstractRenderer
Public Constructors
CategoryStepRenderer()
Creates a new renderer (stagger defaults to false).
CategoryStepRenderer(boolean stagger)
Creates a new renderer.
Public Methods
void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass)
Draw a single data item.
boolean equals(Object obj)
Tests this renderer for equality with an arbitrary object.
LegendItem getLegendItem(int datasetIndex, int series)
Returns a legend item for a series.
boolean getStagger()
Returns the flag that controls whether the series steps are staggered.
void setStagger(boolean shouldStagger)
Sets the flag that controls whether or not the series steps are staggered and sends a RendererChangeEvent to all registered listeners.
Protected Methods
CategoryItemRendererState createState(PlotRenderingInfo info)
Creates a new state instance.
void drawLine(Graphics2D g2, CategoryStepRenderer.State state, PlotOrientation orientation, double x0, double y0, double x1, double y1)
Draws a line taking into account the specified orientation.
[Expand]
Inherited Methods
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

Constants

public static final int STAGGER_WIDTH

The stagger width.

Constant Value: 5 (0x00000005)

Public Constructors

public CategoryStepRenderer ()

Creates a new renderer (stagger defaults to false).

public CategoryStepRenderer (boolean stagger)

Creates a new renderer.

Parameters
stagger should the horizontal part of the step be staggered by series?

Public Methods

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

Draw a single data item.

Parameters
g2 the graphics device.
state the renderer state.
dataArea the area in which the data is drawn.
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.

public boolean equals (Object obj)

Tests this renderer for equality with an arbitrary object.

Parameters
obj the object (null permitted).
Returns
  • A boolean.

public LegendItem getLegendItem (int datasetIndex, int series)

Returns a legend item for a series.

Parameters
datasetIndex the dataset index (zero-based).
series the series index (zero-based).
Returns
  • The legend item.

public boolean getStagger ()

Returns the flag that controls whether the series steps are staggered.

Returns
  • A boolean.

public void setStagger (boolean shouldStagger)

Sets the flag that controls whether or not the series steps are staggered and sends a RendererChangeEvent to all registered listeners.

Parameters
shouldStagger a boolean.

Protected Methods

protected CategoryItemRendererState createState (PlotRenderingInfo info)

Creates a new state instance. This method is called from initialise(Graphics2D, Rectangle2D, CategoryPlot, int, PlotRenderingInfo), and we override it to ensure that the state contains a working Line2D instance.

Parameters
info the plot rendering info (null is permitted).
Returns
  • A new state instance.

protected void drawLine (Graphics2D g2, CategoryStepRenderer.State state, PlotOrientation orientation, double x0, double y0, double x1, double y1)

Draws a line taking into account the specified orientation.

In version 1.0.5, the signature of this method was changed by the addition of the 'state' parameter. This is an incompatible change, but is considered a low risk because it is unlikely that anyone has subclassed this renderer. If this *does* cause trouble for you, please report it as a bug.

Parameters
g2 the graphics device.
state the renderer state.
orientation the plot orientation.
x0 the x-coordinate for the start of the line.
y0 the y-coordinate for the start of the line.
x1 the x-coordinate for the end of the line.
y1 the y-coordinate for the end of the line.