com.jrefinery.chart
Class VerticalXYBarRenderer

java.lang.Object
  extended by com.jrefinery.chart.AbstractXYItemRenderer
      extended by com.jrefinery.chart.VerticalXYBarRenderer
All Implemented Interfaces:
XYItemRenderer

public class VerticalXYBarRenderer
extends AbstractXYItemRenderer
implements XYItemRenderer

A renderer that draws bars on an XY plot (requires an IntervalXYDataset).


Field Summary
protected  double margin
          Percentage margin (to reduce the width of bars).
protected  double translatedRangeZero
          A data value of zero translated to a Java2D value.
 
Fields inherited from class com.jrefinery.chart.AbstractXYItemRenderer
info, listeners, toolTipGenerator
 
Constructor Summary
VerticalXYBarRenderer()
          The default constructor.
VerticalXYBarRenderer(double margin)
          Constructs a new renderer.
VerticalXYBarRenderer(double margin, com.jrefinery.chart.tooltips.XYToolTipGenerator toolTipGenerator)
          Constructs a new renderer.
 
Method Summary
 void drawItem(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset data, int series, int item, CrosshairInfo crosshairInfo)
          Draws the visual representation of a single data item.
 void initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, XYPlot plot, XYDataset data, ChartRenderingInfo info)
          Initialises the renderer.
 void setMargin(double margin)
          Sets the percentage amount by which the bars are trimmed.
 
Methods inherited from class com.jrefinery.chart.AbstractXYItemRenderer
addPropertyChangeListener, firePropertyChanged, getToolTipGenerator, removePropertyChangeListener, setToolTipGenerator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.chart.XYItemRenderer
addPropertyChangeListener, getToolTipGenerator, removePropertyChangeListener, setToolTipGenerator
 

Field Detail

margin

protected double margin
Percentage margin (to reduce the width of bars).


translatedRangeZero

protected double translatedRangeZero
A data value of zero translated to a Java2D value.

Constructor Detail

VerticalXYBarRenderer

public VerticalXYBarRenderer()
The default constructor.


VerticalXYBarRenderer

public VerticalXYBarRenderer(double margin)
Constructs a new renderer.

Parameters:
margin - The percentage amount to trim from the width of each bar.

VerticalXYBarRenderer

public VerticalXYBarRenderer(double margin,
                             com.jrefinery.chart.tooltips.XYToolTipGenerator toolTipGenerator)
Constructs a new renderer.

Parameters:
margin - The percentage amount to trim from the width of each bar.
toolTipGenerator - The tool tip generator (null permitted).
Method Detail

setMargin

public void setMargin(double margin)
Sets the percentage amount by which the bars are trimmed.

Fires a property change event.

Parameters:
margin - The new margin.

initialise

public void initialise(java.awt.Graphics2D g2,
                       java.awt.geom.Rectangle2D dataArea,
                       XYPlot plot,
                       XYDataset data,
                       ChartRenderingInfo info)
Initialises the renderer. Here we calculate the Java2D y-coordinate for zero, since all the bars have their bases fixed at zero.

Specified by:
initialise in interface XYItemRenderer
Overrides:
initialise in class AbstractXYItemRenderer
Parameters:
g2 - The graphics device.
dataArea - The area inside the axes.
plot - The plot.
data - The data.
info - An optional info collection object to return data back to the caller.

drawItem

public void drawItem(java.awt.Graphics2D g2,
                     java.awt.geom.Rectangle2D dataArea,
                     ChartRenderingInfo info,
                     XYPlot plot,
                     ValueAxis domainAxis,
                     ValueAxis rangeAxis,
                     XYDataset data,
                     int series,
                     int item,
                     CrosshairInfo crosshairInfo)
Draws the visual representation of a single data item.

Specified by:
drawItem in interface XYItemRenderer
Parameters:
g2 - The graphics device.
dataArea - The area within which the plot is being drawn.
info - Collects information about the drawing.
plot - The plot (can be used to obtain standard color information etc).
domainAxis - The domain axis.
rangeAxis - The range axis.
data - The dataset.
series - The series index.
item - The item index.


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.