com.jrefinery.chart
Class HorizontalBarRenderer
java.lang.Object
|
+--com.jrefinery.chart.AbstractRenderer
|
+--com.jrefinery.chart.AbstractCategoryItemRenderer
|
+--com.jrefinery.chart.BarRenderer
|
+--com.jrefinery.chart.HorizontalBarRenderer
- All Implemented Interfaces:
- CategoryItemRenderer
- Direct Known Subclasses:
- HorizontalBarRenderer3D, StackedHorizontalBarRenderer
- public class HorizontalBarRenderer
- extends BarRenderer
- implements CategoryItemRenderer
A renderer that handles the drawing of bars for a horizontal bar plot.
- Author:
- DG
Method Summary |
int |
barWidthsPerCategory(CategoryDataset data)
Returns the number of bar widths in each category (used to calculate
the width of a single bar). |
void |
drawCategoryItem(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
ValueAxis axis,
CategoryDataset data,
int series,
java.lang.Object category,
int categoryIndex,
java.lang.Object previousCategory)
Draws the bar for a single (series, category) data item. |
void |
drawRangeMarker(java.awt.Graphics2D g2,
CategoryPlot plot,
ValueAxis axis,
Marker marker,
java.awt.geom.Rectangle2D axisDataArea,
java.awt.Shape dataClipRegion)
Draws a vertical line across the chart to represent the marker. |
boolean |
hasItemGaps()
Returns true to indicate that this renderer does allow for gaps between
items. |
void |
initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
ValueAxis axis,
CategoryDataset data,
ChartRenderingInfo info)
Initialises the renderer. |
Methods inherited from class com.jrefinery.chart.AbstractCategoryItemRenderer |
drawPlotBackground, getAxisArea, getCategoriesPaint, getCategoryPaint, getDataClipRegion, getLegendItem, getPlot, getToolTipGenerator, getURLGenerator, getUseCategoriesPaint, setCategoriesPaint, setPlot, setToolTipGenerator, setURLGenerator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HorizontalBarRenderer
public HorizontalBarRenderer()
- Constructs a new renderer.
HorizontalBarRenderer
public HorizontalBarRenderer(CategoryToolTipGenerator toolTipGenerator)
- Constructs a new renderer with a specific tool tip generator.
- Parameters:
toolTipGenerator
- the tool tip generator.
HorizontalBarRenderer
public HorizontalBarRenderer(CategoryURLGenerator urlGenerator)
- Constructs a new renderer with a specific URL generator.
- Parameters:
urlGenerator
- the URL generator.
HorizontalBarRenderer
public HorizontalBarRenderer(CategoryToolTipGenerator toolTipGenerator,
CategoryURLGenerator urlGenerator)
- Constructs a new renderer with a specific tool tip generator.
- Parameters:
toolTipGenerator
- the tool tip generator.urlGenerator
- the URL generator.
initialise
public void initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
ValueAxis axis,
CategoryDataset data,
ChartRenderingInfo info)
- Initialises the renderer.
This method gets called once at the start of the process of drawing a chart.
- Specified by:
initialise
in interface CategoryItemRenderer
- Overrides:
initialise
in class BarRenderer
- Parameters:
g2
- the graphics device.dataArea
- the area in which the data is to be plotted.plot
- the plot.axis
- the value axis.data
- the data.info
- collects chart rendering information for return to caller.
drawRangeMarker
public void drawRangeMarker(java.awt.Graphics2D g2,
CategoryPlot plot,
ValueAxis axis,
Marker marker,
java.awt.geom.Rectangle2D axisDataArea,
java.awt.Shape dataClipRegion)
- Draws a vertical line across the chart to represent the marker.
- Specified by:
drawRangeMarker
in interface CategoryItemRenderer
- Parameters:
g2
- the graphics device.plot
- the plot.axis
- the value axis.marker
- the marker line.axisDataArea
- the axis data area.dataClipRegion
- the data clip region.
drawCategoryItem
public void drawCategoryItem(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
ValueAxis axis,
CategoryDataset data,
int series,
java.lang.Object category,
int categoryIndex,
java.lang.Object previousCategory)
- Draws the bar for a single (series, category) data item.
- Specified by:
drawCategoryItem
in interface CategoryItemRenderer
- Parameters:
g2
- the graphics device.dataArea
- the data area.plot
- the plot.axis
- the range axis.data
- the data.series
- the series number (zero-based index).category
- the category.categoryIndex
- the category number (zero-based index).previousCategory
- the previous category.
hasItemGaps
public boolean hasItemGaps()
- Returns true to indicate that this renderer does allow for gaps between
items.
- Overrides:
hasItemGaps
in class BarRenderer
- Returns:
true
if this renderer allows gaps between items.
barWidthsPerCategory
public int barWidthsPerCategory(CategoryDataset data)
- Returns the number of bar widths in each category (used to calculate
the width of a single bar).
- Overrides:
barWidthsPerCategory
in class BarRenderer
- Parameters:
data
- the data.- Returns:
- the number of bar widths in each category.