Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.CategoryPlot
public class CategoryPlot
extends Plot
implements ValueAxisPlot, Zoomable, RendererChangeListener, Cloneable, PublicCloneable, Serializable
CategoryDataset
and
renders each data item using a CategoryItemRenderer
.
Field Summary | |
static Paint |
|
static Stroke |
|
static boolean |
|
static boolean |
|
static Paint |
|
static Stroke |
|
static boolean |
|
static Font |
|
protected static ResourceBundle |
|
Fields inherited from class org.jfree.chart.plot.Plot | |
DEFAULT_BACKGROUND_ALPHA , DEFAULT_BACKGROUND_PAINT , DEFAULT_FOREGROUND_ALPHA , DEFAULT_INSETS , DEFAULT_LEGEND_ITEM_BOX , DEFAULT_LEGEND_ITEM_CIRCLE , DEFAULT_OUTLINE_PAINT , DEFAULT_OUTLINE_STROKE , MINIMUM_HEIGHT_TO_DRAW , MINIMUM_WIDTH_TO_DRAW , ZERO |
Constructor Summary | |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected AxisSpace |
|
protected AxisSpace |
|
protected AxisSpace |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Object |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
protected Map |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
boolean |
|
double |
|
List |
|
RectangleInsets |
|
List |
|
List |
|
SortOrder |
|
Range |
|
CategoryDataset |
|
CategoryDataset |
|
int |
|
DatasetRenderingOrder |
|
CategoryAxis |
|
CategoryAxis |
|
int |
|
RectangleEdge |
|
RectangleEdge |
|
CategoryAxis |
|
int |
|
AxisLocation |
|
AxisLocation |
|
Paint |
|
CategoryAnchor |
|
Stroke |
|
Collection |
|
Collection |
|
boolean |
|
AxisSpace |
|
LegendItemCollection |
|
AxisSpace |
|
int |
|
LegendItemCollection |
|
PlotOrientation |
|
String |
|
ValueAxis |
|
ValueAxis |
|
int |
|
RectangleEdge |
|
RectangleEdge |
|
ValueAxis |
|
AxisLocation |
|
AxisLocation |
|
Paint |
|
Stroke |
|
double |
|
Paint |
|
Stroke |
|
Collection |
|
Collection |
|
CategoryItemRenderer |
|
CategoryItemRenderer |
|
CategoryItemRenderer |
|
SortOrder |
|
int |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public static final Paint DEFAULT_CROSSHAIR_PAINT
The default crosshair paint.
- Since:
- 1.0.5
public static final Stroke DEFAULT_CROSSHAIR_STROKE
The default crosshair stroke.
- Since:
- 1.0.5
public static final boolean DEFAULT_CROSSHAIR_VISIBLE
The default crosshair visibility.
- Field Value:
- false
- Since:
- 1.0.5
public static final boolean DEFAULT_DOMAIN_GRIDLINES_VISIBLE
The default visibility of the grid lines plotted against the domain axis.
- Field Value:
- false
public static final Stroke DEFAULT_GRIDLINE_STROKE
The default grid line stroke.
public static final boolean DEFAULT_RANGE_GRIDLINES_VISIBLE
The default visibility of the grid lines plotted against the range axis.
- Field Value:
- true
public static final Font DEFAULT_VALUE_LABEL_FONT
The default value label font.
protected static ResourceBundle localizationResources
The resourceBundle for the localization.
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
Creates a new plot.
- Parameters:
dataset
- the dataset (null
permitted).domainAxis
- the domain axis (null
permitted).rangeAxis
- the range axis (null
permitted).renderer
- the item renderer (null
permitted).
public void addAnnotation(CategoryAnnotation annotation)
Adds an annotation to the plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
annotation
- the annotation (null
not permitted).
- See Also:
removeAnnotation(CategoryAnnotation)
public void addDomainMarker(int index, CategoryMarker marker, Layer layer)
Adds a marker for display by a particular renderer. Typically a marker will be drawn by the renderer as a line perpendicular to a domain axis, however this is entirely up to the renderer.
- Parameters:
index
- the renderer index.marker
- the marker (null
not permitted).layer
- the layer (null
not permitted).
public void addDomainMarker(CategoryMarker marker)
Adds a marker for display (in the foreground) against the domain axis and sends aPlotChangeEvent
to all registered listeners. Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis, however this is entirely up to the renderer.
- Parameters:
marker
- the marker (null
not permitted).
public void addDomainMarker(CategoryMarker marker, Layer layer)
Adds a marker for display against the domain axis and sends aPlotChangeEvent
to all registered listeners. Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis, however this is entirely up to the renderer.
- Parameters:
marker
- the marker (null
not permitted).layer
- the layer (foreground or background) (null
not permitted).
public void addRangeMarker(int index, Marker marker, Layer layer)
Adds a marker for display by a particular renderer. Typically a marker will be drawn by the renderer as a line perpendicular to a range axis, however this is entirely up to the renderer.
- Parameters:
index
- the renderer index.marker
- the marker.layer
- the layer.
public void addRangeMarker(Marker marker)
Adds a marker for display (in the foreground) against the range axis and sends aPlotChangeEvent
to all registered listeners. 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.
- Parameters:
marker
- the marker (null
not permitted).
public void addRangeMarker(Marker marker, Layer layer)
Adds a marker for display against the range axis and sends aPlotChangeEvent
to all registered listeners. 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.
- Parameters:
marker
- the marker (null
not permitted).layer
- the layer (foreground or background) (null
not permitted).
protected AxisSpace calculateAxisSpace(Graphics2D g2, Rectangle2D plotArea)
Calculates the space required for the axes.
- Parameters:
g2
- the graphics device.plotArea
- the plot area.
- Returns:
- The space required for the axes.
protected AxisSpace calculateDomainAxisSpace(Graphics2D g2, Rectangle2D plotArea, AxisSpace space)
Calculates the space required for the domain axis/axes.
- Parameters:
g2
- the graphics device.plotArea
- the plot area.space
- a carrier for the result (null
permitted).
- Returns:
- The required space.
protected AxisSpace calculateRangeAxisSpace(Graphics2D g2, Rectangle2D plotArea, AxisSpace space)
Calculates the space required for the range axis/axes.
- Parameters:
g2
- the graphics device.plotArea
- the plot area.space
- a carrier for the result (null
permitted).
- Returns:
- The required space.
public void clearAnnotations()
Clears all the annotations and sends aPlotChangeEvent
to all registered listeners.
public void clearDomainAxes()
Clears the domain axes from the plot and sends aPlotChangeEvent
to all registered listeners.
public void clearDomainMarkers()
Clears all the domain markers for the plot and sends aPlotChangeEvent
to all registered listeners.
- See Also:
clearRangeMarkers()
public void clearDomainMarkers(int index)
Clears all the domain markers for the specified renderer.
- Parameters:
index
- the renderer index.
- See Also:
clearRangeMarkers(int)
public void clearRangeAxes()
Clears the range axes from the plot and sends aPlotChangeEvent
to all registered listeners.
public void clearRangeMarkers()
Clears all the range markers for the plot and sends aPlotChangeEvent
to all registered listeners.
- See Also:
clearDomainMarkers()
public void clearRangeMarkers(int index)
Clears all the range markers for the specified renderer.
- Parameters:
index
- the renderer index.
- See Also:
clearDomainMarkers(int)
public Object clone() throws CloneNotSupportedException
Returns a clone of the plot.
- Returns:
- A clone.
public void datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset. The range axis bounds will be recalculated if necessary.
- Specified by:
- datasetChanged in interface DatasetChangeListener
- Overrides:
- datasetChanged in interface Plot
- Parameters:
event
- information about the event (not used here).
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo state)
Draws the plot on a Java 2D graphics device (such as the screen or a printer). At your option, you may supply an instance ofPlotRenderingInfo
. If you do, it will be populated with information about the drawing, including various plot dimensions and tooltip info.
- Parameters:
g2
- the graphics device.area
- the area within which the plot (including axes) should be drawn.anchor
- the anchor point (null
permitted).parentState
- the state from the parent plot, if there is one.state
- collects info as the chart is drawn (possiblynull
).
protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea)
Draws the annotations...
- Parameters:
g2
- the graphics device.dataArea
- the data area.
protected Map drawAxes(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, PlotRenderingInfo plotState)
A utility method for drawing the plot's axes.
- Parameters:
g2
- the graphics device.plotArea
- the plot area.dataArea
- the data area.plotState
- collects information about the plot (null
permitted).
- Returns:
- A map containing the axis states.
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea)
Draws the gridlines for the plot.
- Parameters:
g2
- the graphics device.dataArea
- the area inside the axes.
protected void drawDomainMarkers(Graphics2D g2, Rectangle2D dataArea, int index, Layer layer)
Draws the domain markers (if any) for an axis and layer. This method is typically called from within the draw() method.
- Parameters:
g2
- the graphics device.dataArea
- the data area.index
- the renderer index.layer
- the layer (foreground or background).
protected void drawRangeCrosshair(Graphics2D g2, Rectangle2D dataArea, PlotOrientation orientation, double value, ValueAxis axis, Stroke stroke, Paint paint)
Draws a range crosshair.
- Parameters:
g2
- the graphics target.dataArea
- the data area.orientation
- the plot orientation.value
- the crosshair value.axis
- the axis against which the value is measured.stroke
- the stroke used to draw the crosshair line.paint
- the paint used to draw the crosshair line.
- Since:
- 1.0.5
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot.
- Parameters:
g2
- the graphics device.dataArea
- the area inside the axes.ticks
- the ticks.
protected void drawRangeLine(Graphics2D g2, Rectangle2D dataArea, double value, Stroke stroke, Paint paint)
Utility method for drawing a line perpendicular to the range axis (used for crosshairs).
- Parameters:
g2
- the graphics device.dataArea
- the area defined by the axes.value
- the data value.stroke
- the line stroke (null
not permitted).paint
- the line paint (null
not permitted).
protected void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea, int index, Layer layer)
Draws the range markers (if any) for an axis and layer. This method is typically called from within the draw() method.
- Parameters:
g2
- the graphics device.dataArea
- the data area.index
- the renderer index.layer
- the layer (foreground or background).
public boolean equals(Object obj)
Tests the plot for equality with an arbitrary object.
- Parameters:
obj
- the object to test against (null
permitted).
- Returns:
- A boolean.
public double getAnchorValue()
Returns the anchor value.
- Returns:
- The anchor value.
- See Also:
setAnchorValue(double)
public List getAnnotations()
Returns the list of annotations.
- Returns:
- The list of annotations.
public RectangleInsets getAxisOffset()
Returns the axis offset.
- Returns:
- The axis offset (never
null
).
- See Also:
setAxisOffset(RectangleInsets)
public List getCategories()
Returns a list of the categories in the plot's primary dataset.
- Returns:
- A list of the categories in the plot's primary dataset.
- See Also:
getCategoriesForAxis(CategoryAxis)
public List getCategoriesForAxis(CategoryAxis axis)
Returns a list of the categories that should be displayed for the specified axis.
- Parameters:
axis
- the axis (null
not permitted)
- Returns:
- The categories.
- Since:
- 1.0.3
public SortOrder getColumnRenderingOrder()
Returns the order in which the columns are rendered. The default value isSortOrder.ASCENDING
.
- Returns:
- The column rendering order (never
null
- See Also:
setColumnRenderingOrder(SortOrder)
public Range getDataRange(ValueAxis axis)
Returns the range of data values that will be plotted against the range axis. If the dataset isnull
, this method returnsnull
.
- Specified by:
- getDataRange in interface ValueAxisPlot
- Parameters:
axis
- the axis.
- Returns:
- The data range.
public CategoryDataset getDataset()
Returns the primary dataset for the plot.
- Returns:
- The primary dataset (possibly
null
).
- See Also:
setDataset(CategoryDataset)
public CategoryDataset getDataset(int index)
Returns the dataset at the given index.
- Parameters:
index
- the dataset index.
- Returns:
- The dataset (possibly
null
).
- See Also:
setDataset(int,CategoryDataset)
public int getDatasetCount()
Returns the number of datasets.
- Returns:
- The number of datasets.
- Since:
- 1.0.2
public DatasetRenderingOrder getDatasetRenderingOrder()
Returns the dataset rendering order.
- Returns:
- The order (never
null
).
public CategoryAxis getDomainAxis()
Returns the domain axis for the plot. If the domain axis for this plot isnull
, then the method will return the parent plot's domain axis (if there is a parent plot).
- Returns:
- The domain axis (
null
permitted).
- See Also:
setDomainAxis(CategoryAxis)
public CategoryAxis getDomainAxis(int index)
Returns a domain axis.
- Parameters:
index
- the axis index.
- Returns:
- The axis (
null
possible).
- See Also:
setDomainAxis(int,CategoryAxis)
public int getDomainAxisCount()
Returns the number of domain axes.
- Returns:
- The axis count.
public RectangleEdge getDomainAxisEdge()
Returns the domain axis edge. This is derived from the axis location and the plot orientation.
- Returns:
- The edge (never
null
).
public RectangleEdge getDomainAxisEdge(int index)
Returns the edge for a domain axis.
- Parameters:
index
- the axis index.
- Returns:
- The edge (never
null
).
public CategoryAxis getDomainAxisForDataset(int index)
Returns the domain axis for a dataset. You can change the axis for a dataset using themapDatasetToDomainAxis(int,int)
method.
- Parameters:
index
- the dataset index.
- Returns:
- The domain axis.
- See Also:
mapDatasetToDomainAxis(int,int)
public int getDomainAxisIndex(CategoryAxis axis)
Returns the index of the specified axis, or-1
if the axis is not assigned to the plot.
- Parameters:
axis
- the axis.
- Returns:
- The axis index.
- Since:
- 1.0.3
public AxisLocation getDomainAxisLocation()
Returns the domain axis location for the primary domain axis.
- Returns:
- The location (never
null
).
- See Also:
getRangeAxisLocation()
public AxisLocation getDomainAxisLocation(int index)
Returns the location for a domain axis.
- Parameters:
index
- the axis index.
- Returns:
- The location.
public Paint getDomainGridlinePaint()
Returns the paint used to draw grid-lines against the domain axis.
- Returns:
- The paint (never
null
).
- See Also:
setDomainGridlinePaint(Paint)
public CategoryAnchor getDomainGridlinePosition()
Returns the position used for the domain gridlines.
- Returns:
- The gridline position (never
null
).
public Stroke getDomainGridlineStroke()
Returns the stroke used to draw grid-lines against the domain axis.
- Returns:
- The stroke (never
null
).
- See Also:
setDomainGridlineStroke(Stroke)
public Collection getDomainMarkers(Layer layer)
Returns the list of domain markers (read only) for the specified layer.
- Parameters:
layer
- the layer (foreground or background).
- Returns:
- The list of domain markers.
public Collection getDomainMarkers(int index, Layer layer)
Returns a collection of domain markers for a particular renderer and layer.
- Parameters:
index
- the renderer index.layer
- the layer.
- Returns:
- A collection of markers (possibly
null
).
public boolean getDrawSharedDomainAxis()
Returns the flag that controls whether or not the shared domain axis is drawn for each subplot.
- Returns:
- A boolean.
- See Also:
setDrawSharedDomainAxis(boolean)
public AxisSpace getFixedDomainAxisSpace()
Returns the fixed domain axis space.
- Returns:
- The fixed domain axis space (possibly
null
).
- See Also:
setFixedDomainAxisSpace(AxisSpace)
public LegendItemCollection getFixedLegendItems()
Returns the fixed legend items, if any.
- Returns:
- The legend items (possibly
null
).
public AxisSpace getFixedRangeAxisSpace()
Returns the fixed range axis space.
- Returns:
- The fixed range axis space (possibly
null
).
- See Also:
setFixedRangeAxisSpace(AxisSpace)
public int getIndexOf(CategoryItemRenderer renderer)
Returns the index of the specified renderer, or-1
if the renderer is not assigned to this plot.
- Parameters:
renderer
- the renderer (null
permitted).
- Returns:
- The renderer index.
public LegendItemCollection getLegendItems()
Returns the legend items for the plot. By default, this method creates a legend item for each series in each of the datasets. You can change this behaviour by overriding this method.
- Specified by:
- getLegendItems in interface LegendItemSource
- Overrides:
- getLegendItems in interface Plot
- Returns:
- The legend items.
public PlotOrientation getOrientation()
Returns the orientation of the plot.
- Specified by:
- getOrientation in interface Zoomable
- Returns:
- The orientation of the plot (never
null
).
- See Also:
setOrientation(PlotOrientation)
public String getPlotType()
Returns a string describing the type of plot.
- Overrides:
- getPlotType in interface Plot
- Returns:
- The type.
public ValueAxis getRangeAxis()
Returns the range axis for the plot. If the range axis for this plot is null, then the method will return the parent plot's range axis (if there is a parent plot).
- Returns:
- The range axis (possibly
null
).
public ValueAxis getRangeAxis(int index)
Returns a range axis.
- Parameters:
index
- the axis index.
- Returns:
- The axis (
null
possible).
public int getRangeAxisCount()
Returns the number of range axes.
- Returns:
- The axis count.
public RectangleEdge getRangeAxisEdge()
Returns the edge where the primary range axis is located.
- Returns:
- The edge (never
null
).
public RectangleEdge getRangeAxisEdge(int index)
Returns the edge for a range axis.
- Parameters:
index
- the axis index.
- Returns:
- The edge.
public ValueAxis getRangeAxisForDataset(int index)
Returns the range axis for a dataset. You can change the axis for a dataset using themapDatasetToRangeAxis(int,int)
method.
- Parameters:
index
- the dataset index.
- Returns:
- The range axis.
- See Also:
mapDatasetToRangeAxis(int,int)
public AxisLocation getRangeAxisLocation()
Returns the range axis location.
- Returns:
- The location (never
null
).
public AxisLocation getRangeAxisLocation(int index)
Returns the location for a range axis.
- Parameters:
index
- the axis index.
- Returns:
- The location.
public Paint getRangeCrosshairPaint()
Returns the paint used to draw the range crosshair.
- Returns:
- The paint (never
null
).
public Stroke getRangeCrosshairStroke()
Returns the pen-style (Stroke
) used to draw the crosshair (if visible).
- Returns:
- The crosshair stroke (never
null
).
public double getRangeCrosshairValue()
Returns the range crosshair value.
- Returns:
- The value.
- See Also:
setRangeCrosshairValue(double)
public Paint getRangeGridlinePaint()
Returns the paint used to draw the grid-lines against the range axis.
- Returns:
- The paint (never
null
).
- See Also:
setRangeGridlinePaint(Paint)
public Stroke getRangeGridlineStroke()
Returns the stroke used to draw the grid-lines against the range axis.
- Returns:
- The stroke (never
null
).
- See Also:
setRangeGridlineStroke(Stroke)
public Collection getRangeMarkers(Layer layer)
Returns the list of range markers (read only) for the specified layer.
- Parameters:
layer
- the layer (foreground or background).
- Returns:
- The list of range markers.
- See Also:
getRangeMarkers(int,Layer)
public Collection getRangeMarkers(int index, Layer layer)
Returns a collection of range markers for a particular renderer and layer.
- Parameters:
index
- the renderer index.layer
- the layer.
- Returns:
- A collection of markers (possibly
null
).
public CategoryItemRenderer getRenderer()
Returns a reference to the renderer for the plot.
- Returns:
- The renderer.
- See Also:
setRenderer(CategoryItemRenderer)
public CategoryItemRenderer getRenderer(int index)
Returns the renderer at the given index.
- Parameters:
index
- the renderer index.
- Returns:
- The renderer (possibly
null
).
public CategoryItemRenderer getRendererForDataset(CategoryDataset dataset)
Returns the renderer for the specified dataset. If the dataset doesn't belong to the plot, this method will returnnull
.
- Parameters:
dataset
- the dataset (null
permitted).
- Returns:
- The renderer (possibly
null
).
public SortOrder getRowRenderingOrder()
Returns the order in which the rows should be rendered. The default value isSortOrder.ASCENDING
.
- Returns:
- The order (never
null
).
- See Also:
setRowRenderingOrder(SortOrder)
public int getWeight()
Returns the weight for this plot when it is used as a subplot within a combined plot.
- Returns:
- The weight.
- See Also:
setWeight(int)
public void handleClick(int x, int y, PlotRenderingInfo info)
Handles a 'click' on the plot by updating the anchor value.
- Overrides:
- handleClick in interface Plot
- Parameters:
x
- x-coordinate of the click (in Java2D space).y
- y-coordinate of the click (in Java2D space).info
- information about the plot's dimensions.
public boolean isDomainGridlinesVisible()
Returns the flag that controls whether the domain grid-lines are visible.
- Returns:
- The
true
orfalse
.
- See Also:
setDomainGridlinesVisible(boolean)
public boolean isDomainZoomable()
Returnsfalse
to indicate that the domain axes are not zoomable.
- Specified by:
- isDomainZoomable in interface Zoomable
- Returns:
- A boolean.
- See Also:
isRangeZoomable()
public boolean isRangeCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.
- Returns:
- The flag.
public boolean isRangeCrosshairVisible()
Returns a flag indicating whether or not the range crosshair is visible.
- Returns:
- The flag.
- See Also:
setRangeCrosshairVisible(boolean)
public boolean isRangeGridlinesVisible()
Returns the flag that controls whether the range grid-lines are visible.
- Returns:
- The flag.
- See Also:
setRangeGridlinesVisible(boolean)
public boolean isRangeZoomable()
Returnstrue
to indicate that the range axes are zoomable.
- Specified by:
- isRangeZoomable in interface Zoomable
- Returns:
- A boolean.
- See Also:
isDomainZoomable()
public void mapDatasetToDomainAxis(int index, int axisIndex)
Maps a dataset to a particular domain axis.
- Parameters:
index
- the dataset index (zero-based).axisIndex
- the axis index (zero-based).
- See Also:
getDomainAxisForDataset(int)
public void mapDatasetToRangeAxis(int index, int axisIndex)
Maps a dataset to a particular range axis.
- Parameters:
index
- the dataset index (zero-based).axisIndex
- the axis index (zero-based).
- See Also:
getRangeAxisForDataset(int)
public boolean removeAnnotation(CategoryAnnotation annotation)
Removes an annotation from the plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
annotation
- the annotation (null
not permitted).
- Returns:
- A boolean (indicates whether or not the annotation was removed).
- See Also:
addAnnotation(CategoryAnnotation)
public boolean render(Graphics2D g2, Rectangle2D dataArea, int index, PlotRenderingInfo info)
Draws a representation of a dataset within the dataArea region using the appropriate renderer.
- Parameters:
g2
- the graphics device.dataArea
- the region in which the data is to be drawn.index
- the dataset and renderer index.info
- an optional object for collection dimension information.
- Returns:
- A boolean that indicates whether or not real data was found.
public void rendererChanged(RendererChangeEvent event)
Receives notification of a renderer change event.
- Specified by:
- rendererChanged in interface RendererChangeListener
- Parameters:
event
- the event.
public void setAnchorValue(double value)
Sets the anchor value and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
value
- the anchor value.
- See Also:
getAnchorValue()
public void setAnchorValue(double value, boolean notify)
Sets the anchor value and, if requested, sends aPlotChangeEvent
to all registered listeners.
- Parameters:
value
- the value.notify
- notify listeners?
- See Also:
getAnchorValue()
public void setAxisOffset(RectangleInsets offset)
Sets the axis offsets (gap between the data area and the axes) and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
offset
- the offset (null
not permitted).
- See Also:
getAxisOffset()
public void setColumnRenderingOrder(SortOrder order)
Sets the column order in which the items in each dataset should be rendered and sends aPlotChangeEvent
to all registered listeners. Note that this affects the order in which items are drawn, NOT their position in the chart.
- Parameters:
order
- the order (null
not permitted).
public void setDataset(int index, CategoryDataset dataset)
Sets a dataset for the plot.
- Parameters:
index
- the dataset index.dataset
- the dataset (null
permitted).
- See Also:
getDataset(int)
public void setDataset(CategoryDataset dataset)
Sets the dataset for the plot, replacing the existing dataset, if there is one. This method also calls thedatasetChanged(DatasetChangeEvent)
method, which adjusts the axis ranges if necessary and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
dataset
- the dataset (null
permitted).
- See Also:
getDataset()
public void setDatasetRenderingOrder(DatasetRenderingOrder order)
Sets the rendering order and sends aPlotChangeEvent
to all registered listeners. By default, the plot renders the primary dataset last (so that the primary dataset overlays the secondary datasets). You can reverse this if you want to.
- Parameters:
order
- the rendering order (null
not permitted).
- See Also:
getDatasetRenderingOrder()
public void setDomainAxes(CategoryAxis[] axes)
Sets the domain axes for this plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
axes
- the axes (null
not permitted).
- See Also:
setRangeAxes(ValueAxis[])
public void setDomainAxis(int index, CategoryAxis axis)
Sets a domain axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.axis
- the axis (null
permitted).
- See Also:
getDomainAxis(int)
public void setDomainAxis(int index, CategoryAxis axis, boolean notify)
Sets a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.axis
- the axis (null
permitted).notify
- notify listeners?
public void setDomainAxis(CategoryAxis axis)
Sets the domain axis for the plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
axis
- the axis (null
permitted).
- See Also:
getDomainAxis()
public void setDomainAxisLocation(int index, AxisLocation location)
Sets the location for a domain axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.location
- the location.
public void setDomainAxisLocation(int index, AxisLocation location, boolean notify)
Sets the location for a domain axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.location
- the location.notify
- notify listeners?
- Since:
- 1.0.5
public void setDomainAxisLocation(AxisLocation location)
Sets the location of the domain axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
location
- the axis location (null
not permitted).
public void setDomainAxisLocation(AxisLocation location, boolean notify)
Sets the location of the domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.
- Parameters:
location
- the axis location (null
not permitted).notify
- a flag that controls whether listeners are notified.
public void setDomainGridlinePaint(Paint paint)
Sets the paint used to draw the grid-lines (if any) against the domain axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
not permitted).
- See Also:
getDomainGridlinePaint()
public void setDomainGridlinePosition(CategoryAnchor position)
Sets the position used for the domain gridlines and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
position
- the position (null
not permitted).
- See Also:
getDomainGridlinePosition()
public void setDomainGridlineStroke(Stroke stroke)
Sets the stroke used to draw grid-lines against the domain axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
stroke
- the stroke (null
not permitted).
- See Also:
getDomainGridlineStroke()
public void setDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not grid-lines are drawn against the domain axis. If the flag value changes, aPlotChangeEvent
is sent to all registered listeners.
- Parameters:
visible
- the new value of the flag.
- See Also:
isDomainGridlinesVisible()
public void setDrawSharedDomainAxis(boolean draw)
Sets the flag that controls whether the shared domain axis is drawn when this plot is being used as a subplot.
- Parameters:
draw
- a boolean.
- See Also:
getDrawSharedDomainAxis()
public void setFixedDomainAxisSpace(AxisSpace space)
Sets the fixed domain axis space.
- Parameters:
space
- the space (null
permitted).
- See Also:
getFixedDomainAxisSpace()
public void setFixedLegendItems(LegendItemCollection items)
Sets the fixed legend items for the plot. Leave this set tonull
if you prefer the legend items to be created automatically.
- Parameters:
items
- the legend items (null
permitted).
- See Also:
getFixedLegendItems()
public void setFixedRangeAxisSpace(AxisSpace space)
Sets the fixed range axis space.
- Parameters:
space
- the space (null
permitted).
- See Also:
getFixedRangeAxisSpace()
public void setOrientation(PlotOrientation orientation)
Sets the orientation for the plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
orientation
- the orientation (null
not permitted).
- See Also:
getOrientation()
public void setRangeAxes(ValueAxis[] axes)
Sets the range axes for this plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
axes
- the axes (null
not permitted).
- See Also:
setDomainAxes(CategoryAxis[])
public void setRangeAxis(int index, ValueAxis axis)
Sets a range axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.axis
- the axis.
public void setRangeAxis(int index, ValueAxis axis, boolean notify)
Sets a range axis and, if requested, sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.axis
- the axis.notify
- notify listeners?
public void setRangeAxis(ValueAxis axis)
Sets the range axis for the plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
axis
- the axis (null
permitted).
public void setRangeAxisLocation(int index, AxisLocation location)
Sets the location for a range axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.location
- the location.
public void setRangeAxisLocation(int index, AxisLocation location, boolean notify)
Sets the location for a range axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the axis index.location
- the location.notify
- notify listeners?
public void setRangeAxisLocation(AxisLocation location)
Sets the location of the range axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
location
- the location (null
not permitted).
public void setRangeAxisLocation(AxisLocation location, boolean notify)
Sets the location of the range axis and, if requested, sends aPlotChangeEvent
to all registered listeners.
- Parameters:
location
- the location (null
not permitted).notify
- notify listeners?
public void setRangeCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the range crosshair should "lock-on" to actual data values.
- Parameters:
flag
- the flag.
- See Also:
isRangeCrosshairLockedOnData()
public void setRangeCrosshairPaint(Paint paint)
Sets the paint used to draw the range crosshair (if visible) and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
not permitted).
- See Also:
getRangeCrosshairPaint()
public void setRangeCrosshairStroke(Stroke stroke)
Sets the pen-style (Stroke
) used to draw the range crosshair (if visible), and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
stroke
- the new crosshair stroke (null
not permitted).
- See Also:
getRangeCrosshairStroke()
public void setRangeCrosshairValue(double value)
Sets the domain crosshair value. Registered listeners are notified that the plot has been modified, but only if the crosshair is visible.
- Parameters:
value
- the new value.
- See Also:
getRangeCrosshairValue()
public void setRangeCrosshairValue(double value, boolean notify)
Sets the range crosshair value and, if requested, sends aPlotChangeEvent
to all registered listeners (but only if the crosshair is visible).
- Parameters:
value
- the new value.notify
- a flag that controls whether or not listeners are notified.
- See Also:
getRangeCrosshairValue()
public void setRangeCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the range crosshair is visible.
- Parameters:
flag
- the new value of the flag.
- See Also:
isRangeCrosshairVisible()
public void setRangeGridlinePaint(Paint paint)
Sets the paint used to draw the grid lines against the range axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
not permitted).
- See Also:
getRangeGridlinePaint()
public void setRangeGridlineStroke(Stroke stroke)
Sets the stroke used to draw the grid-lines against the range axis and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
stroke
- the stroke (null
not permitted).
- See Also:
getRangeGridlineStroke()
public void setRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not grid-lines are drawn against the range axis. If the flag changes value, aPlotChangeEvent
is sent to all registered listeners.
- Parameters:
visible
- the new value of the flag.
- See Also:
isRangeGridlinesVisible()
public void setRenderer(int index, CategoryItemRenderer renderer)
Sets the renderer at the specified index and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
index
- the index.renderer
- the renderer (null
permitted).
public void setRenderer(int index, CategoryItemRenderer renderer, boolean notify)
Sets a renderer. APlotChangeEvent
is sent to all registered listeners.
- Parameters:
index
- the index.renderer
- the renderer (null
permitted).notify
- notify listeners?
- See Also:
getRenderer(int)
public void setRenderer(CategoryItemRenderer renderer)
Sets the renderer at index 0 (sometimes referred to as the "primary" renderer) and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
renderer
- the renderer (null
permitted.
- See Also:
getRenderer()
public void setRenderer(CategoryItemRenderer renderer, boolean notify)
Sets the renderer at index 0 (sometimes referred to as the "primary" renderer) and, if requested, sends aPlotChangeEvent
to all registered listeners. You can set the renderer tonull
, but this is not recommended because:
- no data will be displayed;
- the plot background will not be painted;
- Parameters:
renderer
- the renderer (null
permitted).notify
- notify listeners?
- See Also:
getRenderer()
public void setRenderers(CategoryItemRenderer[] renderers)
Sets the renderers for this plot and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
renderers
- the renderers.
public void setRowRenderingOrder(SortOrder order)
Sets the row order in which the items in each dataset should be rendered and sends aPlotChangeEvent
to all registered listeners. Note that this affects the order in which items are drawn, NOT their position in the chart.
- Parameters:
order
- the order (null
not permitted).
public void setWeight(int weight)
Sets the weight for the plot.
- Parameters:
weight
- the weight.
- See Also:
getWeight()
public void zoom(double percent)
Zooms (in or out) on the plot's value axis. 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).
- Parameters:
percent
- the zoom amount.
public void zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source)
This method does nothing, becauseCategoryPlot
doesn't support zooming on the domain.
- Specified by:
- zoomDomainAxes in interface Zoomable
- Parameters:
lowerPercent
- the lower bound.upperPercent
- the upper bound.state
- the plot state.source
- the source point (in Java2D space) for the zoom.
public void zoomDomainAxes(double factor, PlotRenderingInfo state, Point2D source)
This method does nothing, becauseCategoryPlot
doesn't support zooming on the domain.
- Specified by:
- zoomDomainAxes in interface Zoomable
- Parameters:
factor
- the zoom factor.state
- the plot state.source
- the source point (in Java2D space) for the zoom.
public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source)
Zooms in on the range axes.
- Specified by:
- zoomRangeAxes in interface Zoomable
- Parameters:
lowerPercent
- the lower bound.upperPercent
- the upper bound.state
- the plot state.source
- the source point (in Java2D space) for the zoom.
public void zoomRangeAxes(double factor, PlotRenderingInfo state, Point2D source)
Multiplies the range on the range axis/axes by the specified factor.
- Specified by:
- zoomRangeAxes in interface Zoomable
- Parameters:
factor
- the zoom factor.state
- the plot state.source
- the source point (in Java2D space) for the zoom.