|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.chart.Plot | +--com.jrefinery.chart.CategoryPlot | +--com.jrefinery.chart.VerticalCategoryPlot
A general class for plotting vertical category charts (bars/lines/shapes), using data from any class that implements the CategoryDataset interface.
The plot relies on a renderer to draw the individual data items, giving some flexibility to change the visual representation of the data.
Plot
,
CategoryItemRenderer
Fields inherited from class com.jrefinery.chart.CategoryPlot |
categoryGapsPercent, domainAxis, introGapPercent, itemGapsPercent, labelFont, labelFormatPattern, labelFormatter, labelPaint, parent, rangeAxis, rangeMarkers, renderer, trailGapPercent, valueLabelsVisible, verticalLabels |
Fields inherited from interface com.jrefinery.chart.CategoryPlotConstants |
DEFAULT_CATEGORY_GAPS_PERCENT, DEFAULT_INTRO_GAP_PERCENT, DEFAULT_ITEM_GAPS_PERCENT, DEFAULT_LABEL_FONT, DEFAULT_TRAIL_GAP_PERCENT, MAX_CATEGORY_GAPS_PERCENT, MAX_INTRO_GAP_PERCENT, MAX_ITEM_GAPS_PERCENT, MAX_TRAIL_GAP_PERCENT |
Fields inherited from interface com.jrefinery.chart.AxisConstants |
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_PAINT, DEFAULT_TICK_STROKE |
Constructor Summary | |
VerticalCategoryPlot(CategoryDataset data,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryItemRenderer renderer)
Constructs a new vertical category plot. |
|
VerticalCategoryPlot(CategoryDataset data,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryItemRenderer renderer,
java.awt.Insets insets,
java.awt.Paint backgroundPaint,
java.awt.Image backgroundImage,
float backgroundAlpha,
java.awt.Stroke outlineStroke,
java.awt.Paint outlinePaint,
float foregroundAlpha,
double introGapPercent,
double trailGapPercent,
double categoryGapPercent,
double itemGapPercent)
Constructs a new vertical category plot. |
Method Summary | |
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
ChartRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer). |
double |
getCategoryCoordinate(int category,
java.awt.geom.Rectangle2D area)
Returns the x-coordinate (in Java 2D User Space) of the center of the specified category. |
CategoryDataset |
getCategoryDataset()
A convenience method that returns the dataset for the plot, cast as a CategoryDataset. |
java.lang.Number |
getMaximumVerticalDataValue()
Returns the maximum value in the range (since the range values are plotted against the vertical axis by this plot). |
java.lang.Number |
getMinimumVerticalDataValue()
Returns the minimum value in the range (since this is plotted against the vertical axis by VerticalBarPlot). |
java.lang.String |
getPlotType()
Returns a short string describing the type of plot. |
Range |
getVerticalDataRange()
Returns the range of data values that will be plotted against the range axis. |
ValueAxis |
getVerticalValueAxis()
Returns the vertical value axis. |
void |
handleClick(int x,
int y,
ChartRenderingInfo info)
Handles a 'click' on the plot by updating the anchor values. |
boolean |
isCompatibleDomainAxis(CategoryAxis axis)
Checks the compatibility of a domain axis, returning true if the axis is compatible with the plot, and false otherwise. |
boolean |
isCompatibleHorizontalAxis(Axis axis)
Checks the compatibility of a horizontal axis, returning true if the axis is compatible with the plot, and false otherwise. |
boolean |
isCompatibleRangeAxis(ValueAxis axis)
Checks the compatibility of a range axis, returning true if the axis is compatible with the plot, and false otherwise. |
boolean |
isCompatibleVerticalAxis(Axis axis)
Checks the compatibility of a vertical axis, returning true if the axis is compatible with the plot, and false otherwise. |
void |
render(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
ChartRenderingInfo info,
java.awt.Shape backgroundPlotArea)
Draws a representation of the data within the dataArea region, using the current renderer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public VerticalCategoryPlot(CategoryDataset data, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
data
- the dataset.domainAxis
- the domain axis.rangeAxis
- the range axis.renderer
- the renderer for the data.public VerticalCategoryPlot(CategoryDataset data, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer, java.awt.Insets insets, java.awt.Paint backgroundPaint, java.awt.Image backgroundImage, float backgroundAlpha, java.awt.Stroke outlineStroke, java.awt.Paint outlinePaint, float foregroundAlpha, double introGapPercent, double trailGapPercent, double categoryGapPercent, double itemGapPercent)
data
- the dataset.domainAxis
- the horizontal axis.rangeAxis
- the vertical axis.renderer
- the renderer for the data.insets
- the amount of space to leave blank around the edges of the plot.backgroundPaint
- an optional color for the plot's background.backgroundImage
- an optional image for the plot's background.backgroundAlpha
- alpha-transparency for the plot's background.outlineStroke
- the Stroke used to draw an outline around the plot.outlinePaint
- the color used to draw an outline around the plot.foregroundAlpha
- the alpha-transparency for the plot.introGapPercent
- the gap before the first bar in the plot, as a percentage of the
available drawing space.trailGapPercent
- the gap after the last bar in the plot, as a percentage of the
available drawing space.categoryGapPercent
- the percentage of drawing space allocated to the gap between
the last bar in one category and the first bar in the next
category.itemGapPercent
- the gap between bars within the same category.Method Detail |
public CategoryDataset getCategoryDataset()
getCategoryDataset
in class CategoryPlot
public ValueAxis getVerticalValueAxis()
This method supports the VerticalValuePlot interface.
getVerticalValueAxis
in interface VerticalValuePlot
public double getCategoryCoordinate(int category, java.awt.geom.Rectangle2D area)
getCategoryCoordinate
in class CategoryPlot
category
- the category (zero based index).area
- the region within which the plot will be drawn.public boolean isCompatibleHorizontalAxis(Axis axis)
axis
- the horizontal axis.true
if the axis is compatible with the plot.public boolean isCompatibleVerticalAxis(Axis axis)
axis
- the vertical axis.true
if the axis is compatible with the plot.public boolean isCompatibleDomainAxis(CategoryAxis axis)
isCompatibleDomainAxis
in class CategoryPlot
axis
- the proposed axis.true
if the axis is compatible with the plot.public boolean isCompatibleRangeAxis(ValueAxis axis)
isCompatibleRangeAxis
in class CategoryPlot
axis
- the proposed axis.public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, ChartRenderingInfo info)
At your option, you may supply an instance of ChartRenderingInfo. If you do, it will be populated with information about the drawing, including various plot dimensions and tooltip info.
draw
in class Plot
g2
- the graphics device.plotArea
- the area within which the plot should be drawn.info
- collects info as the chart is drawn.public void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info, java.awt.Shape backgroundPlotArea)
g2
- the graphics device.dataArea
- the region in which the data is to be drawn.info
- an optional object for collection dimension information.backgroundPlotArea
- the chart's background area.public java.lang.String getPlotType()
getPlotType
in class Plot
public Range getVerticalDataRange()
If the dataset is null, this method returns null.
getVerticalDataRange
in interface VerticalValuePlot
public java.lang.Number getMinimumVerticalDataValue()
This method will return null if the dataset is null.
public java.lang.Number getMaximumVerticalDataValue()
This method will return null if the dataset is null.
public void handleClick(int x, int y, ChartRenderingInfo info)
handleClick
in class Plot
x
- the x coordinate.y
- the y coordinate.info
- the dimensions of the plot.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |