|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jfree.chart.plot.Plot | +--org.jfree.chart.plot.CategoryPlot
A general plotting class that uses data from a CategoryDataset
and renders each data
item using a CategoryItemRenderer
.
Field Summary |
Fields inherited from class org.jfree.chart.plot.Plot |
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO |
Fields inherited from interface org.jfree.chart.plot.CategoryPlotConstants |
DEFAULT_DOMAIN_GRIDLINES_VISIBLE, DEFAULT_GRIDLINE_PAINT, DEFAULT_GRIDLINE_STROKE, DEFAULT_RANGE_GRIDLINES_VISIBLE, DEFAULT_VALUE_LABEL_FONT |
Constructor Summary | |
protected |
CategoryPlot(CategoryDataset data,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
CategoryItemRenderer renderer)
Constructs a category plot, using default values where necessary. |
Method Summary | |
void |
addAnnotation(CategoryAnnotation annotation)
Adds an annotation to the plot. |
void |
addRangeMarker(Marker marker)
Adds a marker for display against the range axis. |
void |
clearRangeMarkers()
Clears all the range markers for the plot. |
void |
datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset. |
java.util.List |
getAnnotations()
Returns the list of annotations. |
CategoryDataset |
getCategoryDataset()
A convenience method that returns the dataset for the plot, cast as a CategoryDataset . |
CategoryAxis |
getDomainAxis()
Returns the domain axis for the plot. |
int |
getDomainAxisLocation()
Returns the domain axis location. |
java.awt.Paint |
getDomainGridlinePaint()
Returns the paint used to draw grid-lines against the domain axis. |
java.awt.Stroke |
getDomainGridlineStroke()
Returns the stroke used to draw grid-lines against the domain axis. |
LegendItemCollection |
getLegendItems()
Returns the legend items for the plot. |
ValueAxis |
getRangeAxis()
Returns the range axis for the plot. |
int |
getRangeAxisLocation()
Returns the range axis location. |
java.awt.Paint |
getRangeCrosshairPaint()
Returns the range crosshair color. |
java.awt.Stroke |
getRangeCrosshairStroke()
Returns the Stroke used to draw the crosshair (if visible). |
double |
getRangeCrosshairValue()
Returns the range crosshair value. |
java.awt.Paint |
getRangeGridlinePaint()
Returns the paint used to draw the grid-lines against the range axis. |
java.awt.Stroke |
getRangeGridlineStroke()
Returns the stroke used to draw the grid-lines against the range axis. |
java.util.List |
getRangeMarkers()
Returns the list of range markers. |
CategoryItemRenderer |
getRenderer()
Returns a reference to the renderer for the plot. |
CategoryDataset |
getSecondaryCategoryDataset()
Returns the secondary dataset, cast as a CategoryDataset . |
ValueAxis |
getSecondaryRangeAxis()
Returns the (optional) secondary range axis. |
CategoryItemRenderer |
getSecondaryRenderer()
Returns the renderer used to draw data items from the secondary dataset. |
java.awt.Font |
getValueLabelFont()
Returns the value label font. |
java.text.NumberFormat |
getValueLabelFormatter()
Returns the value label formatter. |
java.awt.Paint |
getValueLabelPaint()
Returns the value label paint. |
boolean |
getValueLabelsVisible()
Returns a flag that indicates whether or not the value labels are showing. |
boolean |
getVerticalValueLabels()
Returns true if the value labels should be rotated to vertical, and false for standard horizontal labels. |
abstract boolean |
isCompatibleDomainAxis(CategoryAxis axis)
Checks the compatibility of a domain axis, returning true if the axis is compatible with the plot, and false otherwise. |
abstract 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 |
isDomainGridlinesVisible()
Returns the flag that controls whether the domain grid-lines are visible. |
boolean |
isRangeCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values. |
boolean |
isRangeCrosshairVisible()
Returns a flag indicating whether or not the range crosshair is visible. |
boolean |
isRangeGridlinesVisible()
Returns the flag that controls whether the range grid-lines are visible. |
void |
setDomainAxis(CategoryAxis axis)
Sets the domain axis for the plot (this must be compatible with the plot type or an exception is thrown). |
void |
setDomainAxisLocation(int location)
Sets the location of the domain axis. |
void |
setDomainAxisLocation(int location,
boolean notify)
Sets the location of the domain axis. |
void |
setDomainGridlinePaint(java.awt.Paint paint)
Sets the paint used to draw the grid-lines (if any) against the domain axis. |
void |
setDomainGridlineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw grid-lines against the domain axis. |
void |
setDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not grid-lines are drawn against the domain axis. |
void |
setLabelsVisible(boolean flag)
Deprecated. use setValueLabelsVisible(boolean). |
void |
setRangeAxis(ValueAxis axis)
Sets the range axis for the plot. |
void |
setRangeAxisLocation(int location)
Sets the location of the range axis. |
void |
setRangeAxisLocation(int location,
boolean notify)
Sets the location of the range axis. |
void |
setRangeCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the range crosshair should "lock-on" to actual data values. |
void |
setRangeCrosshairPaint(java.awt.Paint paint)
Sets the Paint used to color the crosshairs (if visible) and notifies registered listeners that the axis has been modified. |
void |
setRangeCrosshairStroke(java.awt.Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified. |
void |
setRangeCrosshairValue(double value)
Sets the domain crosshair value. |
void |
setRangeCrosshairValue(double value,
boolean notify)
Sets the range crosshair value. |
void |
setRangeCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the range crosshair is visible. |
void |
setRangeGridlinePaint(java.awt.Paint paint)
Sets the paint used to draw the grid lines against the range axis. |
void |
setRangeGridlineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the grid-lines against the range axis. |
void |
setRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not grid-lines are drawn against the range axis. |
void |
setRenderer(CategoryItemRenderer renderer)
Sets the renderer for the plot. |
void |
setRenderer(CategoryItemRenderer renderer,
boolean notify)
Sets the renderer for the plot. |
void |
setSecondaryRangeAxis(ValueAxis axis)
Sets the secondary range axis. |
void |
setSecondaryRenderer(CategoryItemRenderer renderer)
Sets the renderer used to draw data items from the secondary dataset. |
void |
setValueLabelFont(java.awt.Font font)
Sets the value label font. |
void |
setValueLabelFormatString(java.lang.String format)
Sets the format string for the value labels. |
void |
setValueLabelPaint(java.awt.Paint paint)
Sets the value label paint. |
void |
setValueLabelsVisible(boolean flag)
Sets the flag that indicates whether or not the value labels are showing. |
void |
setVerticalValueLabels(boolean flag)
Sets the flag that determines the orientation of the value labels. |
void |
zoom(double percent)
Zooms (in or out) on the plot's value axis. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected CategoryPlot(CategoryDataset data, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
The domain axis location defaults to BOTTOM and the range axis location defaults to LEFT. These settings are appropriate for a 'vertical' category plot, but must be overridden for a 'horizontal' category plot.
data
- the dataset.domainAxis
- the domain axis.rangeAxis
- the range axis.renderer
- the item renderer.Method Detail |
public LegendItemCollection getLegendItems()
getLegendItems
in class Plot
public CategoryItemRenderer getRenderer()
public void setRenderer(CategoryItemRenderer renderer)
PlotChangeEvent
is sent to all registered
listeners.
renderer
- the renderer.public void setRenderer(CategoryItemRenderer renderer, boolean notify)
You can set the renderer to null
, but this is not recommended because:
renderer
- the renderer (null
permitted).notify
- notify listeners?public CategoryDataset getCategoryDataset()
CategoryDataset
.
public CategoryAxis getDomainAxis()
public void setDomainAxis(CategoryAxis axis) throws AxisNotCompatibleException
axis
- the new axis.
AxisNotCompatibleException
- if axis are not compatible.public int getDomainAxisLocation()
public void setDomainAxisLocation(int location)
Use one of the constants LEFT
, RIGHT
, TOP
or
BOTTOM
.
location
- the axis location.public void setDomainAxisLocation(int location, boolean notify)
Use one of the constants LEFT
, RIGHT
, TOP
or
BOTTOM
.
location
- the axis location.notify
- a flag that controls whether listeners are notified.public ValueAxis getRangeAxis()
public void setRangeAxis(ValueAxis axis) throws AxisNotCompatibleException
An exception is thrown if the new axis and the plot are not mutually compatible.
axis
- the new axis.
AxisNotCompatibleException
- if axis are not compatible.public int getRangeAxisLocation()
public void setRangeAxisLocation(int location)
Use one of the constants LEFT, RIGHT, TOP or BOTTOM.
location
- the location.public void setRangeAxisLocation(int location, boolean notify)
Use one of the constants LEFT, RIGHT, TOP or BOTTOM.
location
- the location.notify
- a flag that controls whether listeners are notified.public CategoryDataset getSecondaryCategoryDataset()
CategoryDataset
.
null
).public ValueAxis getSecondaryRangeAxis()
null
).public void setSecondaryRangeAxis(ValueAxis axis)
A PlotChangeEvent
is sent to all registered listeners.
axis
- the axis (null
permitted).public CategoryItemRenderer getSecondaryRenderer()
public void setSecondaryRenderer(CategoryItemRenderer renderer)
renderer
- the renderer.public boolean isDomainGridlinesVisible()
true
or false
.public void setDomainGridlinesVisible(boolean visible)
If the flag value changes, a PlotChangeEvent
is sent to all registered listeners.
visible
- the new value of the flag.public java.awt.Stroke getDomainGridlineStroke()
public void setDomainGridlineStroke(java.awt.Stroke stroke)
PlotChangeEvent
is sent to all registered listeners.
stroke
- the stroke.public java.awt.Paint getDomainGridlinePaint()
public void setDomainGridlinePaint(java.awt.Paint paint)
PlotChangeEvent
is sent to all registered listeners.
paint
- the paint.public boolean isRangeGridlinesVisible()
public void setRangeGridlinesVisible(boolean visible)
PlotChangeEvent
is sent to all registered listeners.
visible
- the new value of the flag.public java.awt.Stroke getRangeGridlineStroke()
public void setRangeGridlineStroke(java.awt.Stroke stroke)
PlotChangeEvent
is sent to all registered listeners.
stroke
- the stroke.public java.awt.Paint getRangeGridlinePaint()
public void setRangeGridlinePaint(java.awt.Paint paint)
PlotChangeEvent
is sent to all registered listeners.
paint
- the paint.public abstract boolean isCompatibleDomainAxis(CategoryAxis axis)
axis
- the proposed axis.
true
if the axis is compatible with the plot.public abstract boolean isCompatibleRangeAxis(ValueAxis axis)
axis
- the proposed axis.
true
if the axis is compatible with the plot.public void zoom(double percent)
If the value 0.0 is passed in as the zoom percent, the auto-range calculation for the axis is restored (which sets the range to include the minimum and maximum data values, thus displaying all the data).
zoom
in class Plot
percent
- the zoom amount.public boolean getValueLabelsVisible()
public void setLabelsVisible(boolean flag)
Registered listeners are notified of a general change to the axis.
flag
- the flag.public void setValueLabelsVisible(boolean flag)
Registered listeners are notified of a general change to the axis.
Not all renderers support this yet.
flag
- the flag.public java.awt.Font getValueLabelFont()
public void setValueLabelFont(java.awt.Font font)
Notifies registered listeners that the plot has been changed.
font
- the new value label font.public java.awt.Paint getValueLabelPaint()
public void setValueLabelPaint(java.awt.Paint paint)
Notifies registered listeners that the plot has been changed.
paint
- the new value label paint.public java.text.NumberFormat getValueLabelFormatter()
public void setValueLabelFormatString(java.lang.String format)
Notifies registered listeners that the plot has been changed.
format
- the new value label format pattern. Use null
if labels are
not to be shown.public boolean getVerticalValueLabels()
public void setVerticalValueLabels(boolean flag)
flag
- the flag.public void datasetChanged(DatasetChangeEvent event)
The range axis bounds will be recalculated if necessary.
datasetChanged
in interface DatasetChangeListener
datasetChanged
in class Plot
event
- information about the event (not used here).public void addRangeMarker(Marker marker)
Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.
marker
- the marker.public void clearRangeMarkers()
public java.util.List getRangeMarkers()
public boolean isRangeCrosshairVisible()
public void setRangeCrosshairVisible(boolean flag)
flag
- the new value of the flag.public boolean isRangeCrosshairLockedOnData()
public void setRangeCrosshairLockedOnData(boolean flag)
flag
- the flag.public double getRangeCrosshairValue()
public void setRangeCrosshairValue(double value)
Registered listeners are notified that the plot has been modified, but only if the crosshair is visible.
value
- the new value.public void setRangeCrosshairValue(double value, boolean notify)
Registered listeners are notified that the axis has been modified, but only if the crosshair is visible.
value
- the new value.notify
- a flag that controls whether or not listeners are notified.public java.awt.Stroke getRangeCrosshairStroke()
public void setRangeCrosshairStroke(java.awt.Stroke stroke)
stroke
- the new crosshair stroke.public java.awt.Paint getRangeCrosshairPaint()
public void setRangeCrosshairPaint(java.awt.Paint paint)
paint
- the new crosshair paint.public java.util.List getAnnotations()
public void addAnnotation(CategoryAnnotation annotation)
annotation
- the annotation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |