public class

CategoryPlot

extends Plot
implements Serializable Cloneable RendererChangeListener Pannable ValueAxisPlot Zoomable
java.lang.Object
   ↳ org.jfree.chart.plot.Plot
     ↳ org.jfree.chart.plot.CategoryPlot
Known Direct Subclasses

Class Overview

A general plotting class that uses data from a CategoryDataset and renders each data item using a CategoryItemRenderer.

Summary

Constants
boolean DEFAULT_CROSSHAIR_VISIBLE The default crosshair visibility.
boolean DEFAULT_DOMAIN_GRIDLINES_VISIBLE The default visibility of the grid lines plotted against the domain axis.
boolean DEFAULT_RANGE_GRIDLINES_VISIBLE The default visibility of the grid lines plotted against the range axis.
[Expand]
Inherited Constants
From class org.jfree.chart.plot.Plot
Fields
public static final Paint DEFAULT_CROSSHAIR_PAINT The default crosshair paint.
public static final Stroke DEFAULT_CROSSHAIR_STROKE The default crosshair stroke.
public static final Paint DEFAULT_GRIDLINE_PAINT The default grid line paint.
public static final Stroke DEFAULT_GRIDLINE_STROKE The default grid line stroke.
public static final Font DEFAULT_VALUE_LABEL_FONT The default value label font.
protected static ResourceBundle localizationResources The resourceBundle for the localization.
[Expand]
Inherited Fields
From class org.jfree.chart.plot.Plot
Public Constructors
CategoryPlot()
Default constructor.
CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
Creates a new plot.
Public Methods
void addAnnotation(CategoryAnnotation annotation, boolean notify)
Adds an annotation to the plot and, if requested, sends a PlotChangeEvent to all registered listeners.
void addAnnotation(CategoryAnnotation annotation)
Adds an annotation to the plot and sends a PlotChangeEvent to all registered listeners.
void addDomainMarker(CategoryMarker marker)
Adds a marker for display (in the foreground) against the domain axis and sends a PlotChangeEvent to all registered listeners.
void addDomainMarker(CategoryMarker marker, Layer layer)
Adds a marker for display against the domain axis and sends a PlotChangeEvent to all registered listeners.
void addDomainMarker(int index, CategoryMarker marker, Layer layer, boolean notify)
Adds a marker for display by a particular renderer and, if requested, sends a PlotChangeEvent to all registered listeners.
void addDomainMarker(int index, CategoryMarker marker, Layer layer)
Adds a marker for display by a particular renderer and sends a PlotChangeEvent to all registered listeners.
void addRangeMarker(int index, Marker marker, Layer layer, boolean notify)
Adds a marker for display by a particular renderer and sends a PlotChangeEvent to all registered listeners.
void addRangeMarker(Marker marker)
Adds a marker for display (in the foreground) against the range axis and sends a PlotChangeEvent to all registered listeners.
void addRangeMarker(Marker marker, Layer layer)
Adds a marker for display against the range axis and sends a PlotChangeEvent to all registered listeners.
void addRangeMarker(int index, Marker marker, Layer layer)
Adds a marker for display by a particular renderer and sends a PlotChangeEvent to all registered listeners.
void clearAnnotations()
Clears all the annotations and sends a PlotChangeEvent to all registered listeners.
void clearDomainAxes()
Clears the domain axes from the plot and sends a PlotChangeEvent to all registered listeners.
void clearDomainMarkers(int index)
Clears all the domain markers for the specified renderer.
void clearDomainMarkers()
Clears all the domain markers for the plot and sends a PlotChangeEvent to all registered listeners.
void clearRangeAxes()
Clears the range axes from the plot and sends a PlotChangeEvent to all registered listeners.
void clearRangeMarkers(int index)
Clears all the range markers for the specified renderer.
void clearRangeMarkers()
Clears all the range markers for the plot and sends a PlotChangeEvent to all registered listeners.
Object clone()
Returns a clone of the plot.
void configureDomainAxes()
Configures the domain axes.
void configureRangeAxes()
Configures the range axes.
void datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset.
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).
void drawBackground(Graphics2D g2, Rectangle2D area)
Draws the plot background (the background color and/or image).
boolean equals(Object obj)
Tests the plot for equality with an arbitrary object.
double getAnchorValue()
Returns the anchor value.
List getAnnotations()
Returns the list of annotations.
RectangleInsets getAxisOffset()
Returns the axis offset.
List getCategories()
Returns a list of the categories in the plot's primary dataset.
List getCategoriesForAxis(CategoryAxis axis)
Returns a list of the categories that should be displayed for the specified axis.
SortOrder getColumnRenderingOrder()
Returns the order in which the columns are rendered.
int getCrosshairDatasetIndex()
Returns the dataset index for the crosshair.
Range getDataRange(ValueAxis axis)
Returns the range of data values that will be plotted against the range axis.
CategoryDataset getDataset(int index)
Returns the dataset at the given index.
CategoryDataset getDataset()
Returns the primary dataset for the plot.
int getDatasetCount()
Returns the number of datasets.
DatasetRenderingOrder getDatasetRenderingOrder()
Returns the dataset rendering order.
CategoryAxis getDomainAxis(int index)
Returns a domain axis.
CategoryAxis getDomainAxis()
Returns the domain axis for the plot.
int getDomainAxisCount()
Returns the number of domain axes.
RectangleEdge getDomainAxisEdge(int index)
Returns the edge for a domain axis.
RectangleEdge getDomainAxisEdge()
Returns the domain axis edge.
CategoryAxis getDomainAxisForDataset(int index)
Returns the domain axis for a dataset.
int getDomainAxisIndex(CategoryAxis axis)
Returns the index of the specified axis, or -1 if the axis is not assigned to the plot.
AxisLocation getDomainAxisLocation(int index)
Returns the location for a domain axis.
AxisLocation getDomainAxisLocation()
Returns the domain axis location for the primary domain axis.
Comparable getDomainCrosshairColumnKey()
Returns the column key for the domain crosshair.
Paint getDomainCrosshairPaint()
Returns the paint used to draw the domain crosshair.
Comparable getDomainCrosshairRowKey()
Returns the row key for the domain crosshair.
Stroke getDomainCrosshairStroke()
Returns the stroke used to draw the domain crosshair.
Paint getDomainGridlinePaint()
Returns the paint used to draw grid-lines against the domain axis.
CategoryAnchor getDomainGridlinePosition()
Returns the position used for the domain gridlines.
Stroke getDomainGridlineStroke()
Returns the stroke used to draw grid-lines against the domain axis.
Collection getDomainMarkers(int index, Layer layer)
Returns a collection of domain markers for a particular renderer and layer.
Collection getDomainMarkers(Layer layer)
Returns the list of domain markers (read only) for the specified layer.
boolean getDrawSharedDomainAxis()
Returns the flag that controls whether or not the shared domain axis is drawn for each subplot.
AxisSpace getFixedDomainAxisSpace()
Returns the fixed domain axis space.
LegendItemCollection getFixedLegendItems()
Returns the fixed legend items, if any.
AxisSpace getFixedRangeAxisSpace()
Returns the fixed range axis space.
int getIndexOf(CategoryItemRenderer renderer)
Returns the index of the specified renderer, or -1 if the renderer is not assigned to this plot.
LegendItemCollection getLegendItems()
Returns the legend items for the plot.
PlotOrientation getOrientation()
Returns the orientation of the plot.
String getPlotType()
Returns a string describing the type of plot.
ValueAxis getRangeAxis(int index)
Returns a range axis.
ValueAxis getRangeAxis()
Returns the range axis for the plot.
int getRangeAxisCount()
Returns the number of range axes.
RectangleEdge getRangeAxisEdge()
Returns the edge where the primary range axis is located.
RectangleEdge getRangeAxisEdge(int index)
Returns the edge for a range axis.
ValueAxis getRangeAxisForDataset(int index)
Returns the range axis for a dataset.
int getRangeAxisIndex(ValueAxis axis)
Returns the index of the specified axis, or -1 if the axis is not assigned to the plot.
AxisLocation getRangeAxisLocation(int index)
Returns the location for a range axis.
AxisLocation getRangeAxisLocation()
Returns the range axis location.
Paint getRangeCrosshairPaint()
Returns the paint used to draw the range crosshair.
Stroke getRangeCrosshairStroke()
Returns the pen-style (Stroke) used to draw the crosshair (if visible).
double getRangeCrosshairValue()
Returns the range crosshair value.
Paint getRangeGridlinePaint()
Returns the paint used to draw the grid-lines against the range axis.
Stroke getRangeGridlineStroke()
Returns the stroke used to draw the grid-lines against the range axis.
Collection getRangeMarkers(int index, Layer layer)
Returns a collection of range markers for a particular renderer and layer.
Collection getRangeMarkers(Layer layer)
Returns the list of range markers (read only) for the specified layer.
Paint getRangeMinorGridlinePaint()
Returns the paint for the minor grid lines (if any) plotted against the range axis.
Stroke getRangeMinorGridlineStroke()
Returns the stroke for the minor grid lines (if any) plotted against the range axis.
Paint getRangeZeroBaselinePaint()
Returns the paint for the zero baseline (if any) plotted against the range axis.
Stroke getRangeZeroBaselineStroke()
Returns the stroke used for the zero baseline against the range axis.
CategoryItemRenderer getRenderer(int index)
Returns the renderer at the given index.
CategoryItemRenderer getRenderer()
Returns a reference to the renderer for the plot.
int getRendererCount()
Returns the number of renderer slots for this plot.
CategoryItemRenderer getRendererForDataset(CategoryDataset dataset)
Returns the renderer for the specified dataset.
SortOrder getRowRenderingOrder()
Returns the order in which the rows should be rendered.
int getWeight()
Returns the weight for this plot when it is used as a subplot within a combined plot.
void handleClick(int x, int y, PlotRenderingInfo info)
Handles a 'click' on the plot by updating the anchor value.
int indexOf(CategoryDataset dataset)
Returns the index of the specified dataset, or -1 if the dataset does not belong to the plot.
boolean isDomainCrosshairVisible()
Returns the flag that controls whether or not the domain crosshair is displayed by the plot.
boolean isDomainGridlinesVisible()
Returns the flag that controls whether the domain grid-lines are visible.
boolean isDomainPannable()
Returns false always, because the plot cannot be panned along the domain axis/axes.
boolean isDomainZoomable()
Returns false to indicate that the domain axes are not zoomable.
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.
boolean isRangeMinorGridlinesVisible()
Returns true if the range axis minor grid is visible, and false otherwise.
boolean isRangePannable()
Returns true if panning is enabled for the range axes, and false otherwise.
boolean isRangeZeroBaselineVisible()
Returns a flag that controls whether or not a zero baseline is displayed for the range axis.
boolean isRangeZoomable()
Returns true to indicate that the range axes are zoomable.
void mapDatasetToDomainAxes(int index, List axisIndices)
Maps the specified dataset to the axes in the list.
void mapDatasetToDomainAxis(int index, int axisIndex)
Maps a dataset to a particular domain axis.
void mapDatasetToRangeAxes(int index, List axisIndices)
Maps the specified dataset to the axes in the list.
void mapDatasetToRangeAxis(int index, int axisIndex)
Maps a dataset to a particular range axis.
void panDomainAxes(double percent, PlotRenderingInfo info, Point2D source)
Pans the domain axes by the specified percentage.
void panRangeAxes(double percent, PlotRenderingInfo info, Point2D source)
Pans the range axes by the specified percentage.
boolean removeAnnotation(CategoryAnnotation annotation)
Removes an annotation from the plot and sends a PlotChangeEvent to all registered listeners.
boolean removeAnnotation(CategoryAnnotation annotation, boolean notify)
Removes an annotation from the plot and, if requested, sends a PlotChangeEvent to all registered listeners.
boolean removeDomainMarker(int index, Marker marker, Layer layer)
Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.
boolean removeDomainMarker(Marker marker, Layer layer)
Removes a marker for the domain axis in the specified layer and sends a PlotChangeEvent to all registered listeners.
boolean removeDomainMarker(Marker marker)
Removes a marker for the domain axis and sends a PlotChangeEvent to all registered listeners.
boolean removeDomainMarker(int index, Marker marker, Layer layer, boolean notify)
Removes a marker for a specific dataset/renderer and, if requested, sends a PlotChangeEvent to all registered listeners.
boolean removeRangeMarker(int index, Marker marker, Layer layer, boolean notify)
Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.
boolean removeRangeMarker(Marker marker)
Removes a marker for the range axis and sends a PlotChangeEvent to all registered listeners.
boolean removeRangeMarker(int index, Marker marker, Layer layer)
Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.
boolean removeRangeMarker(Marker marker, Layer layer)
Removes a marker for the range axis in the specified layer and sends a PlotChangeEvent to all registered listeners.
boolean render(Graphics2D g2, Rectangle2D dataArea, int index, PlotRenderingInfo info, CategoryCrosshairState crosshairState)
Draws a representation of a dataset within the dataArea region using the appropriate renderer.
void rendererChanged(RendererChangeEvent event)
Receives notification of a renderer change event.
void setAnchorValue(double value)
Sets the anchor value and sends a PlotChangeEvent to all registered listeners.
void setAnchorValue(double value, boolean notify)
Sets the anchor value and, if requested, sends a PlotChangeEvent to all registered listeners.
void setAxisOffset(RectangleInsets offset)
Sets the axis offsets (gap between the data area and the axes) and sends a PlotChangeEvent to all registered listeners.
void setColumnRenderingOrder(SortOrder order)
Sets the column order in which the items in each dataset should be rendered and sends a PlotChangeEvent to all registered listeners.
void setCrosshairDatasetIndex(int index, boolean notify)
Sets the dataset index for the crosshair and, if requested, sends a PlotChangeEvent to all registered listeners.
void setCrosshairDatasetIndex(int index)
Sets the dataset index for the crosshair and sends a PlotChangeEvent to all registered listeners.
void setDataset(int index, CategoryDataset dataset)
Sets a dataset for the plot.
void setDataset(CategoryDataset dataset)
Sets the dataset for the plot, replacing the existing dataset, if there is one.
void setDatasetRenderingOrder(DatasetRenderingOrder order)
Sets the rendering order and sends a PlotChangeEvent to all registered listeners.
void setDomainAxes(CategoryAxis[] axes)
Sets the domain axes for this plot and sends a PlotChangeEvent to all registered listeners.
void setDomainAxis(int index, CategoryAxis axis, boolean notify)
Sets a domain axis and, if requested, sends a PlotChangeEvent to all registered listeners.
void setDomainAxis(int index, CategoryAxis axis)
Sets a domain axis and sends a PlotChangeEvent to all registered listeners.
void setDomainAxis(CategoryAxis axis)
Sets the domain axis for the plot and sends a PlotChangeEvent to all registered listeners.
void setDomainAxisLocation(int index, AxisLocation location, boolean notify)
Sets the location for a domain axis and sends a PlotChangeEvent to all registered listeners.
void setDomainAxisLocation(int index, AxisLocation location)
Sets the location for a domain axis and sends a PlotChangeEvent to all registered listeners.
void setDomainAxisLocation(AxisLocation location, boolean notify)
Sets the location of the domain axis and, if requested, sends a PlotChangeEvent to all registered listeners.
void setDomainAxisLocation(AxisLocation location)
Sets the location of the domain axis and sends a PlotChangeEvent to all registered listeners.
void setDomainCrosshairColumnKey(Comparable key)
Sets the column key for the domain crosshair and sends a PlotChangeEvent to all registered listeners.
void setDomainCrosshairColumnKey(Comparable key, boolean notify)
Sets the column key for the domain crosshair and, if requested, sends a PlotChangeEvent to all registered listeners.
void setDomainCrosshairPaint(Paint paint)
Sets the paint used to draw the domain crosshair.
void setDomainCrosshairRowKey(Comparable key)
Sets the row key for the domain crosshair and sends a {PlotChangeEvent} to all registered listeners.
void setDomainCrosshairRowKey(Comparable key, boolean notify)
Sets the row key for the domain crosshair and, if requested, sends a {PlotChangeEvent} to all registered listeners.
void setDomainCrosshairStroke(Stroke stroke)
Sets the stroke used to draw the domain crosshair, and sends a PlotChangeEvent to all registered listeners.
void setDomainCrosshairVisible(boolean flag)
Sets the flag that controls whether or not the domain crosshair is displayed by the plot, and sends a PlotChangeEvent to all registered listeners.
void setDomainGridlinePaint(Paint paint)
Sets the paint used to draw the grid-lines (if any) against the domain axis and sends a PlotChangeEvent to all registered listeners.
void setDomainGridlinePosition(CategoryAnchor position)
Sets the position used for the domain gridlines and sends a PlotChangeEvent to all registered listeners.
void setDomainGridlineStroke(Stroke stroke)
Sets the stroke used to draw grid-lines against the domain axis and sends a PlotChangeEvent to all registered listeners.
void setDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not grid-lines are drawn against the domain axis.
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.
void setFixedDomainAxisSpace(AxisSpace space)
Sets the fixed domain axis space and sends a PlotChangeEvent to all registered listeners.
void setFixedDomainAxisSpace(AxisSpace space, boolean notify)
Sets the fixed domain axis space and sends a PlotChangeEvent to all registered listeners.
void setFixedLegendItems(LegendItemCollection items)
Sets the fixed legend items for the plot.
void setFixedRangeAxisSpace(AxisSpace space, boolean notify)
Sets the fixed range axis space and sends a PlotChangeEvent to all registered listeners.
void setFixedRangeAxisSpace(AxisSpace space)
Sets the fixed range axis space and sends a PlotChangeEvent to all registered listeners.
void setOrientation(PlotOrientation orientation)
Sets the orientation for the plot and sends a PlotChangeEvent to all registered listeners.
void setRangeAxes(ValueAxis[] axes)
Sets the range axes for this plot and sends a PlotChangeEvent to all registered listeners.
void setRangeAxis(int index, ValueAxis axis, boolean notify)
Sets a range axis and, if requested, sends a PlotChangeEvent to all registered listeners.
void setRangeAxis(ValueAxis axis)
Sets the range axis for the plot and sends a PlotChangeEvent to all registered listeners.
void setRangeAxis(int index, ValueAxis axis)
Sets a range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeAxisLocation(int index, AxisLocation location, boolean notify)
Sets the location for a range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeAxisLocation(AxisLocation location)
Sets the location of the range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeAxisLocation(AxisLocation location, boolean notify)
Sets the location of the range axis and, if requested, sends a PlotChangeEvent to all registered listeners.
void setRangeAxisLocation(int index, AxisLocation location)
Sets the location for a range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the range crosshair should "lock-on" to actual data values, and sends a PlotChangeEvent to all registered listeners.
void setRangeCrosshairPaint(Paint paint)
Sets the paint used to draw the range crosshair (if visible) and sends a PlotChangeEvent to all registered listeners.
void setRangeCrosshairStroke(Stroke stroke)
Sets the pen-style (Stroke) used to draw the range crosshair (if visible), and sends a PlotChangeEvent to all registered listeners.
void setRangeCrosshairValue(double value)
Sets the range crosshair value and, if the crosshair is visible, sends a PlotChangeEvent to all registered listeners.
void setRangeCrosshairValue(double value, boolean notify)
Sets the range crosshair value and, if requested, sends a PlotChangeEvent to all registered listeners (but only if the crosshair is visible).
void setRangeCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the range crosshair is visible.
void setRangeGridlinePaint(Paint paint)
Sets the paint used to draw the grid lines against the range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeGridlineStroke(Stroke stroke)
Sets the stroke used to draw the grid-lines against the range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not grid-lines are drawn against the range axis.
void setRangeMinorGridlinePaint(Paint paint)
Sets the paint for the minor grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeMinorGridlineStroke(Stroke stroke)
Sets the stroke for the minor grid lines plotted against the range axis, and sends a PlotChangeEvent to all registered listeners.
void setRangeMinorGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the range axis minor grid lines are visible.
void setRangePannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along the range axes.
void setRangeZeroBaselinePaint(Paint paint)
Sets the paint for the zero baseline plotted against the range axis and sends a PlotChangeEvent to all registered listeners.
void setRangeZeroBaselineStroke(Stroke stroke)
Sets the stroke for the zero baseline for the range axis, and sends a PlotChangeEvent to all registered listeners.
void setRangeZeroBaselineVisible(boolean visible)
Sets the flag that controls whether or not the zero baseline is displayed for the range axis, and sends a PlotChangeEvent to all registered listeners.
void setRenderer(CategoryItemRenderer renderer, boolean notify)
Sets the renderer at index 0 (sometimes referred to as the "primary" renderer) and, if requested, sends a PlotChangeEvent to all registered listeners.
void setRenderer(int index, CategoryItemRenderer renderer)
Sets the renderer at the specified index and sends a PlotChangeEvent to all registered listeners.
void setRenderer(int index, CategoryItemRenderer renderer, boolean notify)
Sets a renderer.
void setRenderer(CategoryItemRenderer renderer)
Sets the renderer at index 0 (sometimes referred to as the "primary" renderer) and sends a PlotChangeEvent to all registered listeners.
void setRenderers(CategoryItemRenderer[] renderers)
Sets the renderers for this plot and sends a PlotChangeEvent to all registered listeners.
void setRowRenderingOrder(SortOrder order)
Sets the row order in which the items in each dataset should be rendered and sends a PlotChangeEvent to all registered listeners.
void setWeight(int weight)
Sets the weight for the plot and sends a PlotChangeEvent to all registered listeners.
void zoom(double percent)
Zooms (in or out) on the plot's value axis.
void zoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
This method does nothing, because CategoryPlot doesn't support zooming on the domain.
void zoomDomainAxes(double factor, PlotRenderingInfo state, Point2D source)
This method does nothing, because CategoryPlot doesn't support zooming on the domain.
void zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source)
This method does nothing, because CategoryPlot doesn't support zooming on the domain.
void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the range axis/axes by the specified factor.
void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source)
Zooms in on the range axes.
void zoomRangeAxes(double factor, PlotRenderingInfo state, Point2D source)
Multiplies the range on the range axis/axes by the specified factor.
Protected Methods
AxisSpace calculateAxisSpace(Graphics2D g2, Rectangle2D plotArea)
Calculates the space required for the axes.
AxisSpace calculateDomainAxisSpace(Graphics2D g2, Rectangle2D plotArea, AxisSpace space)
Calculates the space required for the domain axis/axes.
AxisSpace calculateRangeAxisSpace(Graphics2D g2, Rectangle2D plotArea, AxisSpace space)
Calculates the space required for the range axis/axes.
void drawAnnotations(Graphics2D g2, Rectangle2D dataArea)
Draws the annotations.
Map drawAxes(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, PlotRenderingInfo plotState)
A utility method for drawing the plot's axes.
void drawDomainCrosshair(Graphics2D g2, Rectangle2D dataArea, PlotOrientation orientation, int datasetIndex, Comparable rowKey, Comparable columnKey, Stroke stroke, Paint paint)
Draws a domain crosshair.
void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea)
Draws the domain gridlines for the plot, if they are visible.
void drawDomainMarkers(Graphics2D g2, Rectangle2D dataArea, int index, Layer layer)
Draws the domain markers (if any) for an axis and layer.
void drawRangeCrosshair(Graphics2D g2, Rectangle2D dataArea, PlotOrientation orientation, double value, ValueAxis axis, Stroke stroke, Paint paint)
Draws a range crosshair.
void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the range gridlines for the plot, if they are visible.
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).
void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea, int index, Layer layer)
Draws the range markers (if any) for an axis and layer.
void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area)
Draws a base line across the chart at value zero on the range axis.
[Expand]
Inherited Methods
From class org.jfree.chart.plot.Plot
From class java.lang.Object
From interface org.jfree.chart.LegendItemSource
From interface org.jfree.chart.event.AxisChangeListener
From interface org.jfree.chart.event.MarkerChangeListener
From interface org.jfree.chart.event.RendererChangeListener
From interface org.jfree.chart.plot.Pannable
From interface org.jfree.chart.plot.ValueAxisPlot
From interface org.jfree.chart.plot.Zoomable
From interface org.jfree.data.general.DatasetChangeListener

Constants

public static final boolean DEFAULT_CROSSHAIR_VISIBLE

The default crosshair visibility.

Constant Value: false

public static final boolean DEFAULT_DOMAIN_GRIDLINES_VISIBLE

The default visibility of the grid lines plotted against the domain axis.

Constant Value: false

public static final boolean DEFAULT_RANGE_GRIDLINES_VISIBLE

The default visibility of the grid lines plotted against the range axis.

Constant Value: true

Fields

public static final Paint DEFAULT_CROSSHAIR_PAINT

The default crosshair paint.

public static final Stroke DEFAULT_CROSSHAIR_STROKE

The default crosshair stroke.

public static final Paint DEFAULT_GRIDLINE_PAINT

The default grid line paint.

public static final Stroke DEFAULT_GRIDLINE_STROKE

The default grid line stroke.

public static final Font DEFAULT_VALUE_LABEL_FONT

The default value label font.

protected static ResourceBundle localizationResources

The resourceBundle for the localization.

Public Constructors

public CategoryPlot ()

Default constructor.

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 Methods

public void addAnnotation (CategoryAnnotation annotation, boolean notify)

Adds an annotation to the plot and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
annotation the annotation (null not permitted).
notify notify listeners?

public void addAnnotation (CategoryAnnotation annotation)

Adds an annotation to the plot and sends a PlotChangeEvent to all registered listeners.

Parameters
annotation the annotation (null not permitted).

public void addDomainMarker (CategoryMarker marker)

Adds a marker for display (in the foreground) against the domain axis and sends a PlotChangeEvent 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 a PlotChangeEvent 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 addDomainMarker (int index, CategoryMarker marker, Layer layer, boolean notify)

Adds a marker for display by a particular renderer and, if requested, sends a PlotChangeEvent to all registered listeners.

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).
notify notify listeners?

public void addDomainMarker (int index, CategoryMarker marker, Layer layer)

Adds a marker for display by a particular renderer and sends a PlotChangeEvent to all registered listeners.

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 addRangeMarker (int index, Marker marker, Layer layer, boolean notify)

Adds a marker for display by a particular renderer and sends a PlotChangeEvent to all registered listeners.

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.
notify notify listeners?

public void addRangeMarker (Marker marker)

Adds a marker for display (in the foreground) against the range axis and sends a PlotChangeEvent 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 a PlotChangeEvent 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).

public void addRangeMarker (int index, Marker marker, Layer layer)

Adds a marker for display by a particular renderer and sends a PlotChangeEvent to all registered listeners.

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 clearAnnotations ()

Clears all the annotations and sends a PlotChangeEvent to all registered listeners.

public void clearDomainAxes ()

Clears the domain axes from the plot and sends a PlotChangeEvent to all registered listeners.

public void clearDomainMarkers (int index)

Clears all the domain markers for the specified renderer.

Parameters
index the renderer index.

public void clearDomainMarkers ()

Clears all the domain markers for the plot and sends a PlotChangeEvent to all registered listeners.

public void clearRangeAxes ()

Clears the range axes from the plot and sends a PlotChangeEvent to all registered listeners.

public void clearRangeMarkers (int index)

Clears all the range markers for the specified renderer.

Parameters
index the renderer index.

public void clearRangeMarkers ()

Clears all the range markers for the plot and sends a PlotChangeEvent to all registered listeners.

public Object clone ()

Returns a clone of the plot.

Returns
  • A clone.
Throws
CloneNotSupportedException if the cloning is not supported.

public void configureDomainAxes ()

Configures the domain axes.

public void configureRangeAxes ()

Configures the range axes.

public void datasetChanged (DatasetChangeEvent event)

Receives notification of a change to the plot's dataset.

The range axis bounds will be recalculated if necessary.

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 of PlotRenderingInfo. 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 (possibly null).

public void drawBackground (Graphics2D g2, Rectangle2D area)

Draws the plot background (the background color and/or image).

This method will be called during the chart drawing process and is declared public so that it can be accessed by the renderers used by certain subclasses. You shouldn't need to call this method directly.

Parameters
g2 the graphics device.
area the area within which the plot should be drawn.

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.

public List getAnnotations ()

Returns the list of annotations.

Returns
  • The list of annotations (never null).

public RectangleInsets getAxisOffset ()

Returns the axis offset.

Returns
  • The axis offset (never null).

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.

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.

public SortOrder getColumnRenderingOrder ()

Returns the order in which the columns are rendered. The default value is SortOrder.ASCENDING.

Returns
  • The column rendering order (never null

public int getCrosshairDatasetIndex ()

Returns the dataset index for the crosshair.

Returns
  • The dataset index.

public Range getDataRange (ValueAxis axis)

Returns the range of data values that will be plotted against the range axis. If the dataset is null, this method returns null.

Parameters
axis the axis.
Returns
  • The data range.

public CategoryDataset getDataset (int index)

Returns the dataset at the given index.

Parameters
index the dataset index.
Returns
  • The dataset (possibly null).

public CategoryDataset getDataset ()

Returns the primary dataset for the plot.

Returns
  • The primary dataset (possibly null).

public int getDatasetCount ()

Returns the number of datasets.

Returns
  • The number of datasets.

public DatasetRenderingOrder getDatasetRenderingOrder ()

Returns the dataset rendering order.

Returns
  • The order (never null).

public CategoryAxis getDomainAxis (int index)

Returns a domain axis.

Parameters
index the axis index.
Returns
  • The axis (null possible).

public CategoryAxis getDomainAxis ()

Returns the domain axis for the plot. If the domain axis for this plot is null, then the method will return the parent plot's domain axis (if there is a parent plot).

Returns
  • The domain axis (null permitted).

public int getDomainAxisCount ()

Returns the number of domain axes.

Returns
  • The axis count.

public RectangleEdge getDomainAxisEdge (int index)

Returns the edge for a domain axis.

Parameters
index the axis index.
Returns
  • The edge (never null).

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 CategoryAxis getDomainAxisForDataset (int index)

Returns the domain axis for a dataset. You can change the axis for a dataset using the mapDatasetToDomainAxis(int, int) method.

Parameters
index the dataset index.
Returns
  • The domain axis.

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 (null not permitted).
Returns
  • The axis index.

public AxisLocation getDomainAxisLocation (int index)

Returns the location for a domain axis.

Parameters
index the axis index.
Returns
  • The location.

public AxisLocation getDomainAxisLocation ()

Returns the domain axis location for the primary domain axis.

Returns
  • The location (never null).

public Comparable getDomainCrosshairColumnKey ()

Returns the column key for the domain crosshair.

Returns
  • The column key.

public Paint getDomainCrosshairPaint ()

Returns the paint used to draw the domain crosshair.

Returns
  • The paint (never null).

public Comparable getDomainCrosshairRowKey ()

Returns the row key for the domain crosshair.

Returns
  • The row key.

public Stroke getDomainCrosshairStroke ()

Returns the stroke used to draw the domain crosshair.

Returns
  • The stroke (never null).

public Paint getDomainGridlinePaint ()

Returns the paint used to draw grid-lines against the domain axis.

Returns
  • The paint (never null).

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).

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 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 boolean getDrawSharedDomainAxis ()

Returns the flag that controls whether or not the shared domain axis is drawn for each subplot.

Returns
  • A boolean.

public AxisSpace getFixedDomainAxisSpace ()

Returns the fixed domain axis space.

Returns
  • The fixed domain axis space (possibly null).

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).

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.

Returns
  • The legend items.

public PlotOrientation getOrientation ()

Returns the orientation of the plot.

Returns
  • The orientation of the plot (never null).

public String getPlotType ()

Returns a string describing the type of plot.

Returns
  • The type.

public ValueAxis getRangeAxis (int index)

Returns a range axis.

Parameters
index the axis index.
Returns
  • The axis (null possible).

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 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 the mapDatasetToRangeAxis(int, int) method.

Parameters
index the dataset index.
Returns
  • The range axis.

public int getRangeAxisIndex (ValueAxis axis)

Returns the index of the specified axis, or -1 if the axis is not assigned to the plot.

Parameters
axis the axis (null not permitted).
Returns
  • The axis index.

public AxisLocation getRangeAxisLocation (int index)

Returns the location for a range axis.

Parameters
index the axis index.
Returns
  • The location.

public AxisLocation getRangeAxisLocation ()

Returns the range axis location.

Returns
  • The location (never null).

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.

public Paint getRangeGridlinePaint ()

Returns the paint used to draw the grid-lines against the range axis.

Returns
  • The paint (never null).

public Stroke getRangeGridlineStroke ()

Returns the stroke used to draw the grid-lines against the range axis.

Returns
  • The stroke (never null).

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 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.

public Paint getRangeMinorGridlinePaint ()

Returns the paint for the minor grid lines (if any) plotted against the range axis.

Returns
  • The paint (never null).

public Stroke getRangeMinorGridlineStroke ()

Returns the stroke for the minor grid lines (if any) plotted against the range axis.

Returns
  • The stroke (never null).

public Paint getRangeZeroBaselinePaint ()

Returns the paint for the zero baseline (if any) plotted against the range axis.

Returns
  • The paint (never null).

public Stroke getRangeZeroBaselineStroke ()

Returns the stroke used for the zero baseline against the range axis.

Returns
  • The stroke (never null).

public CategoryItemRenderer getRenderer (int index)

Returns the renderer at the given index.

Parameters
index the renderer index.
Returns
  • The renderer (possibly null).

public CategoryItemRenderer getRenderer ()

Returns a reference to the renderer for the plot.

Returns
  • The renderer.

public int getRendererCount ()

Returns the number of renderer slots for this plot.

Returns
  • The number of renderer slots.

public CategoryItemRenderer getRendererForDataset (CategoryDataset dataset)

Returns the renderer for the specified dataset. If the dataset doesn't belong to the plot, this method will return null.

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 is SortOrder.ASCENDING.

Returns
  • The order (never null).

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

public void handleClick (int x, int y, PlotRenderingInfo info)

Handles a 'click' on the plot by updating the anchor value.

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 int indexOf (CategoryDataset dataset)

Returns the index of the specified dataset, or -1 if the dataset does not belong to the plot.

Parameters
dataset the dataset (null not permitted).
Returns
  • The index.

public boolean isDomainCrosshairVisible ()

Returns the flag that controls whether or not the domain crosshair is displayed by the plot.

Returns
  • A boolean.

public boolean isDomainGridlinesVisible ()

Returns the flag that controls whether the domain grid-lines are visible.

Returns
  • The true or false.

public boolean isDomainPannable ()

Returns false always, because the plot cannot be panned along the domain axis/axes.

Returns
  • A boolean.

public boolean isDomainZoomable ()

Returns false to indicate that the domain axes are not zoomable.

Returns
  • A boolean.

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.

public boolean isRangeGridlinesVisible ()

Returns the flag that controls whether the range grid-lines are visible.

Returns
  • The flag.

public boolean isRangeMinorGridlinesVisible ()

Returns true if the range axis minor grid is visible, and false otherwise.

Returns
  • A boolean.

public boolean isRangePannable ()

Returns true if panning is enabled for the range axes, and false otherwise.

Returns
  • A boolean.

public boolean isRangeZeroBaselineVisible ()

Returns a flag that controls whether or not a zero baseline is displayed for the range axis.

Returns
  • A boolean.

public boolean isRangeZoomable ()

Returns true to indicate that the range axes are zoomable.

Returns
  • A boolean.

public void mapDatasetToDomainAxes (int index, List axisIndices)

Maps the specified dataset to the axes in the list. Note that the conversion of data values into Java2D space is always performed using the first axis in the list.

Parameters
index the dataset index (zero-based).
axisIndices the axis indices (null permitted).

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).

public void mapDatasetToRangeAxes (int index, List axisIndices)

Maps the specified dataset to the axes in the list. Note that the conversion of data values into Java2D space is always performed using the first axis in the list.

Parameters
index the dataset index (zero-based).
axisIndices the axis indices (null permitted).

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).

public void panDomainAxes (double percent, PlotRenderingInfo info, Point2D source)

Pans the domain axes by the specified percentage.

Parameters
percent the distance to pan (as a percentage of the axis length).
info the plot info
source the source point where the pan action started.

public void panRangeAxes (double percent, PlotRenderingInfo info, Point2D source)

Pans the range axes by the specified percentage.

Parameters
percent the distance to pan (as a percentage of the axis length).
info the plot info
source the source point where the pan action started.

public boolean removeAnnotation (CategoryAnnotation annotation)

Removes an annotation from the plot and sends a PlotChangeEvent to all registered listeners.

Parameters
annotation the annotation (null not permitted).
Returns
  • A boolean (indicates whether or not the annotation was removed).

public boolean removeAnnotation (CategoryAnnotation annotation, boolean notify)

Removes an annotation from the plot and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
annotation the annotation (null not permitted).
notify notify listeners?
Returns
  • A boolean (indicates whether or not the annotation was removed).

public boolean removeDomainMarker (int index, Marker marker, Layer layer)

Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.

Parameters
index the dataset/renderer index.
marker the marker.
layer the layer (foreground or background).
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeDomainMarker (Marker marker, Layer layer)

Removes a marker for the domain axis in the specified layer and sends a PlotChangeEvent to all registered listeners.

Parameters
marker the marker (null not permitted).
layer the layer (foreground or background).
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeDomainMarker (Marker marker)

Removes a marker for the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
marker the marker.
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeDomainMarker (int index, Marker marker, Layer layer, boolean notify)

Removes a marker for a specific dataset/renderer and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
index the dataset/renderer index.
marker the marker.
layer the layer (foreground or background).
notify notify listeners?
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeRangeMarker (int index, Marker marker, Layer layer, boolean notify)

Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.

Parameters
index the dataset/renderer index.
marker the marker.
layer the layer (foreground or background).
notify notify listeners.
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeRangeMarker (Marker marker)

Removes a marker for the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
marker the marker.
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeRangeMarker (int index, Marker marker, Layer layer)

Removes a marker for a specific dataset/renderer and sends a PlotChangeEvent to all registered listeners.

Parameters
index the dataset/renderer index.
marker the marker.
layer the layer (foreground or background).
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean removeRangeMarker (Marker marker, Layer layer)

Removes a marker for the range axis in the specified layer and sends a PlotChangeEvent to all registered listeners.

Parameters
marker the marker (null not permitted).
layer the layer (foreground or background).
Returns
  • A boolean indicating whether or not the marker was actually removed.

public boolean render (Graphics2D g2, Rectangle2D dataArea, int index, PlotRenderingInfo info, CategoryCrosshairState crosshairState)

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.
crosshairState a state object for tracking crosshair info (null permitted).
Returns
  • A boolean that indicates whether or not real data was found.

public void rendererChanged (RendererChangeEvent event)

Receives notification of a renderer change event.

Parameters
event the event.

public void setAnchorValue (double value)

Sets the anchor value and sends a PlotChangeEvent to all registered listeners.

Parameters
value the anchor value.
See Also

public void setAnchorValue (double value, boolean notify)

Sets the anchor value and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
value the value.
notify notify listeners?
See Also

public void setAxisOffset (RectangleInsets offset)

Sets the axis offsets (gap between the data area and the axes) and sends a PlotChangeEvent to all registered listeners.

Parameters
offset the offset (null not permitted).
See Also

public void setColumnRenderingOrder (SortOrder order)

Sets the column order in which the items in each dataset should be rendered and sends a PlotChangeEvent 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 setCrosshairDatasetIndex (int index, boolean notify)

Sets the dataset index for the crosshair and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
index the index.
notify notify listeners?

public void setCrosshairDatasetIndex (int index)

Sets the dataset index for the crosshair and sends a PlotChangeEvent to all registered listeners.

Parameters
index the index.

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

public void setDataset (CategoryDataset dataset)

Sets the dataset for the plot, replacing the existing dataset, if there is one. This method also calls the datasetChanged(DatasetChangeEvent) method, which adjusts the axis ranges if necessary and sends a PlotChangeEvent to all registered listeners.

Parameters
dataset the dataset (null permitted).
See Also

public void setDatasetRenderingOrder (DatasetRenderingOrder order)

Sets the rendering order and sends a PlotChangeEvent 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).

public void setDomainAxes (CategoryAxis[] axes)

Sets the domain axes for this plot and sends a PlotChangeEvent to all registered listeners.

Parameters
axes the axes (null not permitted).

public void setDomainAxis (int index, CategoryAxis axis, boolean notify)

Sets a domain axis and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
index the axis index.
axis the axis (null permitted).
notify notify listeners?

public void setDomainAxis (int index, CategoryAxis axis)

Sets a domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
index the axis index.
axis the axis (null permitted).

public void setDomainAxis (CategoryAxis axis)

Sets the domain axis for the plot and sends a PlotChangeEvent to all registered listeners.

Parameters
axis the axis (null permitted).
See Also

public void setDomainAxisLocation (int index, AxisLocation location, boolean notify)

Sets the location for a domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
index the axis index.
location the location.
notify notify listeners?

public void setDomainAxisLocation (int index, AxisLocation location)

Sets the location for a domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
index the axis index.
location the location.

public void setDomainAxisLocation (AxisLocation location, boolean notify)

Sets the location of the domain axis and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
location the axis location (null not permitted).
notify a flag that controls whether listeners are notified.

public void setDomainAxisLocation (AxisLocation location)

Sets the location of the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
location the axis location (null not permitted).

public void setDomainCrosshairColumnKey (Comparable key)

Sets the column key for the domain crosshair and sends a PlotChangeEvent to all registered listeners.

Parameters
key the key.

public void setDomainCrosshairColumnKey (Comparable key, boolean notify)

Sets the column key for the domain crosshair and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters
key the key.
notify notify listeners?

public void setDomainCrosshairPaint (Paint paint)

Sets the paint used to draw the domain crosshair.

Parameters
paint the paint (null not permitted).

public void setDomainCrosshairRowKey (Comparable key)

Sets the row key for the domain crosshair and sends a {PlotChangeEvent} to all registered listeners.

Parameters
key the key.

public void setDomainCrosshairRowKey (Comparable key, boolean notify)

Sets the row key for the domain crosshair and, if requested, sends a {PlotChangeEvent} to all registered listeners.

Parameters
key the key.
notify notify listeners?

public void setDomainCrosshairStroke (Stroke stroke)

Sets the stroke used to draw the domain crosshair, and sends a PlotChangeEvent to all registered listeners.

Parameters
stroke the stroke (null not permitted).

public void setDomainCrosshairVisible (boolean flag)

Sets the flag that controls whether or not the domain crosshair is displayed by the plot, and sends a PlotChangeEvent to all registered listeners.

Parameters
flag the new flag value.

public void setDomainGridlinePaint (Paint paint)

Sets the paint used to draw the grid-lines (if any) against the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setDomainGridlinePosition (CategoryAnchor position)

Sets the position used for the domain gridlines and sends a PlotChangeEvent to all registered listeners.

Parameters
position the position (null not permitted).

public void setDomainGridlineStroke (Stroke stroke)

Sets the stroke used to draw grid-lines against the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters
stroke the stroke (null not permitted).

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, a PlotChangeEvent is sent to all registered listeners.

Parameters
visible the new value of the flag.

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.

public void setFixedDomainAxisSpace (AxisSpace space)

Sets the fixed domain axis space and sends a PlotChangeEvent to all registered listeners.

Parameters
space the space (null permitted).

public void setFixedDomainAxisSpace (AxisSpace space, boolean notify)

Sets the fixed domain axis space and sends a PlotChangeEvent to all registered listeners.

Parameters
space the space (null permitted).
notify notify listeners?

public void setFixedLegendItems (LegendItemCollection items)

Sets the fixed legend items for the plot. Leave this set to null if you prefer the legend items to be created automatically.

Parameters
items the legend items (null permitted).

public void setFixedRangeAxisSpace (AxisSpace space, boolean notify)

Sets the fixed range axis space and sends a PlotChangeEvent to all registered listeners.

Parameters
space the space (null permitted).
notify notify listeners?

public void setFixedRangeAxisSpace (AxisSpace space)

Sets the fixed range axis space and sends a PlotChangeEvent to all registered listeners.

Parameters
space the space (null permitted).

public void setOrientation (PlotOrientation orientation)

Sets the orientation for the plot and sends a PlotChangeEvent to all registered listeners.

Parameters
orientation the orientation (null not permitted).
See Also

public void setRangeAxes (ValueAxis[] axes)

Sets the range axes for this plot and sends a PlotChangeEvent to all registered listeners.

Parameters
axes the axes (null not permitted).

public void setRangeAxis (int index, ValueAxis axis, boolean notify)

Sets a range axis and, if requested, sends a PlotChangeEvent 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 a PlotChangeEvent to all registered listeners.

Parameters
axis the axis (null permitted).

public void setRangeAxis (int index, ValueAxis axis)

Sets a range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
index the axis index.
axis the axis.

public void setRangeAxisLocation (int index, AxisLocation location, boolean notify)

Sets the location for a range axis and sends a PlotChangeEvent 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 a PlotChangeEvent 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 a PlotChangeEvent to all registered listeners.

Parameters
location the location (null not permitted).
notify notify listeners?

public void setRangeAxisLocation (int index, AxisLocation location)

Sets the location for a range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
index the axis index.
location the location.

public void setRangeCrosshairLockedOnData (boolean flag)

Sets the flag indicating whether or not the range crosshair should "lock-on" to actual data values, and sends a PlotChangeEvent to all registered listeners.

Parameters
flag the flag.

public void setRangeCrosshairPaint (Paint paint)

Sets the paint used to draw the range crosshair (if visible) and sends a PlotChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setRangeCrosshairStroke (Stroke stroke)

Sets the pen-style (Stroke) used to draw the range crosshair (if visible), and sends a PlotChangeEvent to all registered listeners.

Parameters
stroke the new crosshair stroke (null not permitted).

public void setRangeCrosshairValue (double value)

Sets the range crosshair value and, if the crosshair is visible, sends a PlotChangeEvent to all registered listeners.

Parameters
value the new value.

public void setRangeCrosshairValue (double value, boolean notify)

Sets the range crosshair value and, if requested, sends a PlotChangeEvent 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.

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.

public void setRangeGridlinePaint (Paint paint)

Sets the paint used to draw the grid lines against the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setRangeGridlineStroke (Stroke stroke)

Sets the stroke used to draw the grid-lines against the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
stroke the stroke (null not permitted).

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, a PlotChangeEvent is sent to all registered listeners.

Parameters
visible the new value of the flag.

public void setRangeMinorGridlinePaint (Paint paint)

Sets the paint for the minor grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setRangeMinorGridlineStroke (Stroke stroke)

Sets the stroke for the minor grid lines plotted against the range axis, and sends a PlotChangeEvent to all registered listeners.

Parameters
stroke the stroke (null not permitted).

public void setRangeMinorGridlinesVisible (boolean visible)

Sets the flag that controls whether or not the range axis minor grid lines are visible.

If the flag value is changed, a PlotChangeEvent is sent to all registered listeners.

Parameters
visible the new value of the flag.

public void setRangePannable (boolean pannable)

Sets the flag that enables or disables panning of the plot along the range axes.

Parameters
pannable the new flag value.

public void setRangeZeroBaselinePaint (Paint paint)

Sets the paint for the zero baseline plotted against the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters
paint the paint (null not permitted).

public void setRangeZeroBaselineStroke (Stroke stroke)

Sets the stroke for the zero baseline for the range axis, and sends a PlotChangeEvent to all registered listeners.

Parameters
stroke the stroke (null not permitted).

public void setRangeZeroBaselineVisible (boolean visible)

Sets the flag that controls whether or not the zero baseline is displayed for the range axis, and sends a PlotChangeEvent to all registered listeners.

Parameters
visible the flag.

public void setRenderer (CategoryItemRenderer renderer, boolean notify)

Sets the renderer at index 0 (sometimes referred to as the "primary" renderer) and, if requested, sends a PlotChangeEvent to all registered listeners.

You can set the renderer to null, 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

public void setRenderer (int index, CategoryItemRenderer renderer)

Sets the renderer at the specified index and sends a PlotChangeEvent 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. A PlotChangeEvent is sent to all registered listeners.

Parameters
index the index.
renderer the renderer (null permitted).
notify notify listeners?
See Also

public void setRenderer (CategoryItemRenderer renderer)

Sets the renderer at index 0 (sometimes referred to as the "primary" renderer) and sends a PlotChangeEvent to all registered listeners.

Parameters
renderer the renderer (null permitted.
See Also

public void setRenderers (CategoryItemRenderer[] renderers)

Sets the renderers for this plot and sends a PlotChangeEvent 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 a PlotChangeEvent 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 and sends a PlotChangeEvent to all registered listeners.

Parameters
weight the weight.
See Also

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 factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)

This method does nothing, because CategoryPlot doesn't support zooming on the domain.

Parameters
factor the zoom factor.
info the plot rendering info.
source the source point (in Java2D space).
useAnchor use source point as zoom anchor?

public void zoomDomainAxes (double factor, PlotRenderingInfo state, Point2D source)

This method does nothing, because CategoryPlot doesn't support zooming on the domain.

Parameters
factor the zoom factor.
state the plot state.
source the source point (in Java2D space) for the zoom.

public void zoomDomainAxes (double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source)

This method does nothing, because CategoryPlot doesn't support zooming on the domain.

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 info, Point2D source, boolean useAnchor)

Multiplies the range on the range axis/axes by the specified factor.

Parameters
factor the zoom factor.
info the plot rendering info.
source the source point.
useAnchor a flag that controls whether or not the source point is used for the zoom anchor.

public void zoomRangeAxes (double lowerPercent, double upperPercent, PlotRenderingInfo state, Point2D source)

Zooms in on the range axes.

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.

Parameters
factor the zoom factor.
state the plot state.
source the source point (in Java2D space) for the zoom.

Protected Methods

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.

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 drawDomainCrosshair (Graphics2D g2, Rectangle2D dataArea, PlotOrientation orientation, int datasetIndex, Comparable rowKey, Comparable columnKey, Stroke stroke, Paint paint)

Draws a domain crosshair.

Parameters
g2 the graphics target.
dataArea the data area.
orientation the plot orientation.
datasetIndex the dataset index.
rowKey the row key.
columnKey the column key.
stroke the stroke used to draw the crosshair line.
paint the paint used to draw the crosshair line.

protected void drawDomainGridlines (Graphics2D g2, Rectangle2D dataArea)

Draws the domain gridlines for the plot, if they are visible.

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.

protected void drawRangeGridlines (Graphics2D g2, Rectangle2D dataArea, List ticks)

Draws the range gridlines for the plot, if they are visible.

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).

protected void drawZeroRangeBaseline (Graphics2D g2, Rectangle2D area)

Draws a base line across the chart at value zero on the range axis.

Parameters
g2 the graphics device.
area the data area.