org.jfree.chart.plot
Class CategoryPlot

java.lang.Object
  extended byorg.jfree.chart.plot.Plot
      extended byorg.jfree.chart.plot.CategoryPlot
All Implemented Interfaces:
AxisChangeListener, AxisConstants, java.lang.Cloneable, DatasetChangeListener, java.util.EventListener, org.jfree.util.PublicCloneable, RendererChangeListener, java.io.Serializable, ValueAxisPlot
Direct Known Subclasses:
CombinedDomainCategoryPlot, CombinedRangeCategoryPlot

public class CategoryPlot
extends Plot
implements ValueAxisPlot, RendererChangeListener, java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable

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

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
static boolean DEFAULT_DOMAIN_GRIDLINES_VISIBLE
          The default visibility of the grid lines plotted against the domain axis.
static java.awt.Paint DEFAULT_GRIDLINE_PAINT
          The default grid line paint.
static java.awt.Stroke DEFAULT_GRIDLINE_STROKE
          The default grid line stroke.
static boolean DEFAULT_RANGE_GRIDLINES_VISIBLE
          The default visibility of the grid lines plotted against the range axis.
static java.awt.Font DEFAULT_VALUE_LABEL_FONT
          The default value label font.
protected static java.util.ResourceBundle localizationResources
          The resourceBundle for the localization.
 
Fields inherited from class org.jfree.chart.plot.Plot
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO
 
Fields inherited from interface org.jfree.chart.axis.AxisConstants
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE
 
Constructor Summary
CategoryPlot()
          Default constructor.
CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
          Creates a new plot.
 
Method Summary
 void addAnnotation(CategoryAnnotation annotation)
          Adds an annotation to the plot.
 void addRangeMarker(Marker marker)
          Adds a marker for display against the range axis.
 void addRangeMarker(Marker marker, org.jfree.ui.Layer layer)
          Adds a marker for display against the range axis.
 void addSecondaryRangeMarker(int index, Marker marker, org.jfree.ui.Layer layer)
          Adds a marker for display against the secondary range axis.
 void addSecondaryRangeMarker(Marker marker)
          Deprecated. Use addSecondaryRangeMarker(int, Marker, Layer).
protected  AxisSpace calculateAxisSpace(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea)
          Calculates the space required for the axes.
protected  AxisSpace calculateDomainAxisSpace(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, AxisSpace space)
          Calculates the space required for the domain axis/axes.
protected  AxisSpace calculateRangeAxisSpace(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, AxisSpace space)
          Calculates the space required for the range axis/axes.
 void clearRangeMarkers()
          Clears all the range markers for the plot.
 void clearSecondaryDomainAxes()
          Clears the secondary domain axes from the plot.
 void clearSecondaryRangeAxes()
          Clears the secondary range axes from the plot.
 void clearSecondaryRangeMarkers()
          Deprecated. Use clearSecondaryRangeMarkers(int).
 void clearSecondaryRangeMarkers(int index)
          Clears all the secondary range markers for the plot.
 java.lang.Object clone()
          Returns a clone of the plot.
 void configureSecondaryDomainAxes()
          Configures the secondary domain axes.
 void configureSecondaryRangeAxes()
          Configures the secondary range axes.
 void datasetChanged(DatasetChangeEvent event)
          Receives notification of a change to the plot's dataset.
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, PlotState parentState, PlotRenderingInfo state)
          Draws the plot on a Java 2D graphics device (such as the screen or a printer).
protected  void drawAnnotations(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea)
          Draws the annotations...
protected  java.util.Map drawAxes(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea)
          A utility method for drawing the plot's axes.
protected  void drawDomainGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea)
          Draws the gridlines for the plot.
protected  void drawRangeGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List ticks)
          Draws the gridlines for the plot.
protected  void drawRangeLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Stroke stroke, java.awt.Paint paint)
          Utility method for drawing a line perpendicular to the range axis (used for crosshairs).
protected  void drawRangeMarkers(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.Layer layer)
          Draws the range markers (if any) for the specified layer.
protected  void drawSecondaryRangeMarkers(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea)
          Deprecated. Use drawSecondaryRangeMarkers(g2, dataArea, int, Layer).
protected  void drawSecondaryRangeMarkers(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, int index, org.jfree.ui.Layer layer)
          Draws the secondary range markers (if any) for an axis and layer.
 boolean equals(java.lang.Object object)
          Tests the plot for equality with an arbitrary object.
 double getAnchorValue()
          Returns the anchor value.
 java.util.List getAnnotations()
          Returns the list of annotations.
 Spacer getAxisOffset()
          Returns the axis offset.
 java.util.List getCategories()
          Returns a list of the categories for the plot.
 org.jfree.util.SortOrder getColumnRenderingOrder()
          Returns the order in which the columns are rendered.
 Range getDataRange(ValueAxis axis)
          Returns the range of data values that will be plotted against the range axis.
 CategoryDataset getDataset()
          Returns the primary dataset for the plot.
 DatasetRenderingOrder getDatasetRenderingOrder()
          Returns the dataset rendering order.
 CategoryAxis getDomainAxis()
          Returns the domain axis for the plot.
 org.jfree.ui.RectangleEdge getDomainAxisEdge()
          Returns the domain axis edge.
 AxisLocation getDomainAxisLocation()
          Returns the domain axis location.
 java.awt.Paint getDomainGridlinePaint()
          Returns the paint used to draw grid-lines against the domain axis.
 CategoryAnchor getDomainGridlinePosition()
          Returns the position used for the domain gridlines.
 java.awt.Stroke getDomainGridlineStroke()
          Returns the stroke used to draw grid-lines against the domain axis.
 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.
 AxisSpace getFixedRangeAxisSpace()
          Returns the fixed range axis space.
 LegendItemCollection getLegendItems()
          Returns the legend items for the plot.
 PlotOrientation getOrientation()
          Returns the orientation of the plot.
 java.lang.String getPlotType()
          Returns a string describing the type of plot.
 ValueAxis getRangeAxis()
          Returns the range axis for the plot.
 org.jfree.ui.RectangleEdge getRangeAxisEdge()
          Returns the range axis edge.
 ValueAxis getRangeAxisForSecondaryDataset(int index)
          Returns the range axis for a secondary dataset.
 AxisLocation getRangeAxisLocation()
          Returns the range axis location.
 java.awt.Paint getRangeCrosshairPaint()
          Returns the range crosshair color.
 java.awt.Stroke getRangeCrosshairStroke()
          Returns the pen-style (Stroke) used to draw the crosshair (if visible).
 double getRangeCrosshairValue()
          Returns the range crosshair value.
 java.awt.Paint getRangeGridlinePaint()
          Returns the paint used to draw the grid-lines against the range axis.
 java.awt.Stroke getRangeGridlineStroke()
          Returns the stroke used to draw the grid-lines against the range axis.
 java.util.List getRangeMarkers()
          Deprecated. Use getRangeMarkers(Layer).
 java.util.List getRangeMarkers(org.jfree.ui.Layer layer)
          Returns the list of range markers (read only) for the specified layer.
 CategoryItemRenderer getRenderer()
          Returns a reference to the renderer for the plot.
 org.jfree.util.SortOrder getRowRenderingOrder()
          Returns the order in which the rows should be rendered.
 CategoryDataset getSecondaryDataset(int index)
          Returns one of the secondary datasets.
 CategoryAxis getSecondaryDomainAxis(int index)
          Returns a secondary domain axis.
 org.jfree.ui.RectangleEdge getSecondaryDomainAxisEdge(int index)
          Returns the edge for a secondary domain axis.
 AxisLocation getSecondaryDomainAxisLocation(int index)
          Returns the location for a secondary domain axis.
 ValueAxis getSecondaryRangeAxis(int index)
          Returns a secondary range axis.
 org.jfree.ui.RectangleEdge getSecondaryRangeAxisEdge(int index)
          Returns the edge for a secondary range axis.
 AxisLocation getSecondaryRangeAxisLocation(int index)
          Returns the location for a secondary range axis.
 java.util.List getSecondaryRangeMarkers()
          Deprecated. Use getSecondaryRangeMarkers(int, Layer), and note that it returns a Collection rather than a List.
 java.util.Collection getSecondaryRangeMarkers(int index, org.jfree.ui.Layer layer)
          Returns a collection of secondary range markers for a particular axis and layer.
 CategoryItemRenderer getSecondaryRenderer(int index)
          Returns a secondary renderer.
 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.
 boolean isDomainGridlinesVisible()
          Returns the flag that controls whether the domain grid-lines are visible.
 boolean isRangeCrosshairLockedOnData()
          Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.
 boolean isRangeCrosshairVisible()
          Returns a flag indicating whether or not the range crosshair is visible.
 boolean isRangeGridlinesVisible()
          Returns the flag that controls whether the range grid-lines are visible.
 void mapSecondaryDatasetToDomainAxis(int index, java.lang.Integer key)
          Maps a secondary dataset to a particular domain axis.
 void mapSecondaryDatasetToRangeAxis(int index, java.lang.Integer key)
          Maps a secondary dataset to a particular range axis.
 void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info)
          Draws a representation of the data within the dataArea region, using the current renderer.
 void render2(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info)
          Draws a representation of the data in the secondary dataset(s) within the dataArea region, using the current renderer.
 void rendererChanged(RendererChangeEvent event)
          Receives notification of a renderer change event.
 void setAnchorValue(double value)
          Sets the anchor value.
 void setAnchorValue(double value, boolean notify)
          Sets the anchor value.
 void setAxisOffset(Spacer offset)
          Sets the axis offsets (gap between the data area and the axes).
 void setColumnRenderingOrder(org.jfree.util.SortOrder order)
          Sets the order in which the columns should be rendered.
 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.
 void setDomainAxis(CategoryAxis axis)
          Sets the domain axis for the plot (this must be compatible with the plot type or an exception is thrown).
 void setDomainAxisLocation(AxisLocation location)
          Sets the location of the domain axis.
 void setDomainAxisLocation(AxisLocation location, boolean notify)
          Sets the location of the domain axis.
 void setDomainGridlinePaint(java.awt.Paint paint)
          Sets the paint used to draw the grid-lines (if any) against the domain axis.
 void setDomainGridlinePosition(CategoryAnchor position)
          Sets the position used for the domain gridlines.
 void setDomainGridlineStroke(java.awt.Stroke stroke)
          Sets the stroke used to draw grid-lines against the domain axis.
 void setDomainGridlinesVisible(boolean visible)
          Sets the flag that controls whether or not grid-lines are drawn against the domain axis.
 void setFixedDomainAxisSpace(AxisSpace space)
          Sets the fixed domain axis space.
 void setFixedRangeAxisSpace(AxisSpace space)
          Sets the fixed range axis space.
 void setOrientation(PlotOrientation orientation)
          Sets the orientation for the plot.
 void setRangeAxis(ValueAxis axis)
          Sets the range axis for the plot.
 void setRangeAxisLocation(AxisLocation location)
          Sets the location of the range axis.
 void setRangeAxisLocation(AxisLocation location, boolean notify)
          Sets the location of the range axis.
 void setRangeCrosshairLockedOnData(boolean flag)
          Sets the flag indicating whether or not the range crosshair should "lock-on" to actual data values.
 void setRangeCrosshairPaint(java.awt.Paint paint)
          Sets the Paint used to color the crosshairs (if visible) and notifies registered listeners that the axis has been modified.
 void setRangeCrosshairStroke(java.awt.Stroke stroke)
          Sets the pen-style (Stroke) used to draw the crosshairs (if visible).
 void setRangeCrosshairValue(double value)
          Sets the domain crosshair value.
 void setRangeCrosshairValue(double value, boolean notify)
          Sets the range crosshair value.
 void setRangeCrosshairVisible(boolean flag)
          Sets the flag indicating whether or not the range crosshair is visible.
 void setRangeGridlinePaint(java.awt.Paint paint)
          Sets the paint used to draw the grid lines against the range axis.
 void setRangeGridlineStroke(java.awt.Stroke stroke)
          Sets the stroke used to draw the grid-lines against the range axis.
 void setRangeGridlinesVisible(boolean visible)
          Sets the flag that controls whether or not grid-lines are drawn against the range axis.
 void setRenderer(CategoryItemRenderer renderer)
          Sets the renderer for the plot.
 void setRenderer(CategoryItemRenderer renderer, boolean notify)
          Sets the renderer for the plot.
 void setRowRenderingOrder(org.jfree.util.SortOrder order)
          Sets the order in which the rows should be rendered.
 void setSecondaryDataset(int index, CategoryDataset dataset)
          Adds or changes a secondary dataset for the plot.
 void setSecondaryDomainAxis(int index, CategoryAxis axis)
          Sets a secondary domain axis.
 void setSecondaryDomainAxisLocation(int index, AxisLocation location)
          Sets the location for a secondary domain axis.
 void setSecondaryRangeAxis(int index, ValueAxis axis)
          Sets a secondary range axis.
 void setSecondaryRangeAxisLocation(int index, AxisLocation location)
          Sets the location for a secondary range axis.
 void setSecondaryRenderer(int index, CategoryItemRenderer renderer)
          Sets a secondary renderer.
 void setWeight(int weight)
          Sets the weight for the plot.
 void zoom(double percent)
          Zooms (in or out) on the plot's value axis.
 void zoomHorizontalAxes(double factor)
          Multiplies the range on the horizontal axis/axes by the specified factor.
 void zoomHorizontalAxes(double lowerPercent, double upperPercent)
          Zooms in on the horizontal axes.
 void zoomVerticalAxes(double factor)
          Multiplies the range on the vertical axis/axes by the specified factor.
 void zoomVerticalAxes(double lowerPercent, double upperPercent)
          Zooms in on the vertical axes.
 
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, axisChanged, draw, drawBackground, drawNoDataMessage, drawOutline, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundPaint, getDataAreaRatio, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, isSubplot, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundPaint, setDataAreaRatio, setDatasetGroup, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DOMAIN_GRIDLINES_VISIBLE

public static final boolean DEFAULT_DOMAIN_GRIDLINES_VISIBLE
The default visibility of the grid lines plotted against the domain axis.

See Also:
Constant Field Values

DEFAULT_RANGE_GRIDLINES_VISIBLE

public static final boolean DEFAULT_RANGE_GRIDLINES_VISIBLE
The default visibility of the grid lines plotted against the range axis.

See Also:
Constant Field Values

DEFAULT_GRIDLINE_STROKE

public static final java.awt.Stroke DEFAULT_GRIDLINE_STROKE
The default grid line stroke.


DEFAULT_GRIDLINE_PAINT

public static final java.awt.Paint DEFAULT_GRIDLINE_PAINT
The default grid line paint.


DEFAULT_VALUE_LABEL_FONT

public static final java.awt.Font DEFAULT_VALUE_LABEL_FONT
The default value label font.


localizationResources

protected static java.util.ResourceBundle localizationResources
The resourceBundle for the localization.

Constructor Detail

CategoryPlot

public CategoryPlot()
Default constructor.


CategoryPlot

public CategoryPlot(CategoryDataset dataset,
                    CategoryAxis domainAxis,
                    ValueAxis rangeAxis,
                    CategoryItemRenderer renderer)
Creates a new plot.

Parameters:
dataset - the dataset.
domainAxis - the domain axis.
rangeAxis - the range axis.
renderer - the item renderer.
Method Detail

getPlotType

public java.lang.String getPlotType()
Returns a string describing the type of plot.

Specified by:
getPlotType in class Plot
Returns:
The type.

getOrientation

public PlotOrientation getOrientation()
Returns the orientation of the plot.

Returns:
The orientation of the plot.

setOrientation

public void setOrientation(PlotOrientation orientation)
Sets the orientation for the plot.

Parameters:
orientation - the orientation.

getAxisOffset

public Spacer getAxisOffset()
Returns the axis offset.

Returns:
The axis offset.

setAxisOffset

public void setAxisOffset(Spacer offset)
Sets the axis offsets (gap between the data area and the axes).

Parameters:
offset - the offset.

getDomainAxis

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.

setDomainAxis

public void setDomainAxis(CategoryAxis axis)
Sets the domain axis for the plot (this must be compatible with the plot type or an exception is thrown).

Parameters:
axis - the new axis.

getDomainAxisLocation

public AxisLocation getDomainAxisLocation()
Returns the domain axis location.

Returns:
the domain axis location.

setDomainAxisLocation

public void setDomainAxisLocation(AxisLocation location)
Sets the location of the domain axis. A PlotChangeEvent is sent to all registered listeners.

Parameters:
location - the axis location.

setDomainAxisLocation

public void setDomainAxisLocation(AxisLocation location,
                                  boolean notify)
Sets the location of the domain axis.

Parameters:
location - the axis location.
notify - a flag that controls whether listeners are notified.

getDomainAxisEdge

public org.jfree.ui.RectangleEdge getDomainAxisEdge()
Returns the domain axis edge.

Returns:
The edge.

getSecondaryDomainAxis

public CategoryAxis getSecondaryDomainAxis(int index)
Returns a secondary domain axis.

Parameters:
index - the axis index.
Returns:
The axis (null possible).

setSecondaryDomainAxis

public void setSecondaryDomainAxis(int index,
                                   CategoryAxis axis)
Sets a secondary domain axis.

Parameters:
index - the axis index.
axis - the axis.

clearSecondaryDomainAxes

public void clearSecondaryDomainAxes()
Clears the secondary domain axes from the plot.


configureSecondaryDomainAxes

public void configureSecondaryDomainAxes()
Configures the secondary domain axes.


getSecondaryDomainAxisLocation

public AxisLocation getSecondaryDomainAxisLocation(int index)
Returns the location for a secondary domain axis.

Parameters:
index - the axis index.
Returns:
The location.

setSecondaryDomainAxisLocation

public void setSecondaryDomainAxisLocation(int index,
                                           AxisLocation location)
Sets the location for a secondary domain axis.

Parameters:
index - the axis index.
location - the location.

getSecondaryDomainAxisEdge

public org.jfree.ui.RectangleEdge getSecondaryDomainAxisEdge(int index)
Returns the edge for a secondary domain axis.

Parameters:
index - the axis index.
Returns:
The edge.

getRangeAxis

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.

setRangeAxis

public void setRangeAxis(ValueAxis axis)
Sets the range axis for the plot.

An exception is thrown if the new axis and the plot are not mutually compatible.

Parameters:
axis - the new axis.

getRangeAxisLocation

public AxisLocation getRangeAxisLocation()
Returns the range axis location.

Returns:
the range axis location.

setRangeAxisLocation

public void setRangeAxisLocation(AxisLocation location)
Sets the location of the range axis.

Parameters:
location - the location.

setRangeAxisLocation

public void setRangeAxisLocation(AxisLocation location,
                                 boolean notify)
Sets the location of the range axis.

Parameters:
location - the location.
notify - a flag that controls whether listeners are notified.

getRangeAxisEdge

public org.jfree.ui.RectangleEdge getRangeAxisEdge()
Returns the range axis edge.

Returns:
The edge.

getSecondaryRangeAxis

public ValueAxis getSecondaryRangeAxis(int index)
Returns a secondary range axis.

Parameters:
index - the axis index.
Returns:
The axis (null possible).

setSecondaryRangeAxis

public void setSecondaryRangeAxis(int index,
                                  ValueAxis axis)
Sets a secondary range axis.

Parameters:
index - the axis index.
axis - the axis.

clearSecondaryRangeAxes

public void clearSecondaryRangeAxes()
Clears the secondary range axes from the plot.


configureSecondaryRangeAxes

public void configureSecondaryRangeAxes()
Configures the secondary range axes.


getSecondaryRangeAxisLocation

public AxisLocation getSecondaryRangeAxisLocation(int index)
Returns the location for a secondary range axis.

Parameters:
index - the axis index.
Returns:
The location.

setSecondaryRangeAxisLocation

public void setSecondaryRangeAxisLocation(int index,
                                          AxisLocation location)
Sets the location for a secondary range axis.

Parameters:
index - the axis index.
location - the location.

getSecondaryRangeAxisEdge

public org.jfree.ui.RectangleEdge getSecondaryRangeAxisEdge(int index)
Returns the edge for a secondary range axis.

Parameters:
index - the axis index.
Returns:
The edge.

getDataset

public CategoryDataset getDataset()
Returns the primary dataset for the plot.

Returns:
The primary dataset (possibly null).

setDataset

public void setDataset(CategoryDataset dataset)
Sets the dataset for the plot, replacing the existing dataset if there is one.

Parameters:
dataset - the dataset (null permitted).

getSecondaryDataset

public CategoryDataset getSecondaryDataset(int index)
Returns one of the secondary datasets.

Parameters:
index - the dataset index.
Returns:
The dataset (possibly null).

setSecondaryDataset

public void setSecondaryDataset(int index,
                                CategoryDataset dataset)
Adds or changes a secondary dataset for the plot.

Parameters:
index - the dataset index.
dataset - the dataset.

mapSecondaryDatasetToDomainAxis

public void mapSecondaryDatasetToDomainAxis(int index,
                                            java.lang.Integer key)
Maps a secondary dataset to a particular domain axis.

Parameters:
index - the dataset index (zero-based).
key - the key (null for primary axis, or the index of the secondary axis).

mapSecondaryDatasetToRangeAxis

public void mapSecondaryDatasetToRangeAxis(int index,
                                           java.lang.Integer key)
Maps a secondary dataset to a particular range axis.

Parameters:
index - the dataset index (zero-based).
key - the key (null for primary axis, or the index of the secondary axis).

getRangeAxisForSecondaryDataset

public ValueAxis getRangeAxisForSecondaryDataset(int index)
Returns the range axis for a secondary dataset.

You can change the axis for a dataset using the mapSecondaryDatasetToRangeAxis method.

Parameters:
index - the dataset index.
Returns:
The range axis.

getRenderer

public CategoryItemRenderer getRenderer()
Returns a reference to the renderer for the plot.

Returns:
The renderer.

setRenderer

public void setRenderer(CategoryItemRenderer renderer)
Sets the renderer for the plot. A PlotChangeEvent is sent to all registered listeners.

Parameters:
renderer - the renderer.

setRenderer

public void setRenderer(CategoryItemRenderer renderer,
                        boolean notify)
Sets the renderer for the plot.

You can set the renderer to null, but this is not recommended because:

Parameters:
renderer - the renderer (null permitted).
notify - notify listeners?

getSecondaryRenderer

public CategoryItemRenderer getSecondaryRenderer(int index)
Returns a secondary renderer.

Parameters:
index - the renderer index.
Returns:
The renderer (possibly null).

setSecondaryRenderer

public void setSecondaryRenderer(int index,
                                 CategoryItemRenderer renderer)
Sets a secondary renderer. A PlotChangeEvent is sent to all registered listeners.

Parameters:
index - the index.
renderer - the renderer.

getDatasetRenderingOrder

public DatasetRenderingOrder getDatasetRenderingOrder()
Returns the dataset rendering order.

Returns:
The dataset rendering order.

setDatasetRenderingOrder

public void setDatasetRenderingOrder(DatasetRenderingOrder order)
Sets the rendering order. A PlotChangeEvent is sent to all registered listeners.

By default, the plot renders the secondary dataset first, then the primary dataset (so that the primary dataset overlays the secondary dataset). You can reverse this if you want to.

Parameters:
order - the rendering order.

getColumnRenderingOrder

public org.jfree.util.SortOrder getColumnRenderingOrder()
Returns the order in which the columns are rendered.

Returns:
The order.

setColumnRenderingOrder

public void setColumnRenderingOrder(org.jfree.util.SortOrder order)
Sets the order in which the columns should be rendered.

Parameters:
order - the order.

getRowRenderingOrder

public org.jfree.util.SortOrder getRowRenderingOrder()
Returns the order in which the rows should be rendered.

Returns:
The order.

setRowRenderingOrder

public void setRowRenderingOrder(org.jfree.util.SortOrder order)
Sets the order in which the rows should be rendered.

Parameters:
order - the order.

isDomainGridlinesVisible

public boolean isDomainGridlinesVisible()
Returns the flag that controls whether the domain grid-lines are visible.

Returns:
the true or false.

setDomainGridlinesVisible

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.

getDomainGridlinePosition

public CategoryAnchor getDomainGridlinePosition()
Returns the position used for the domain gridlines.

Returns:
The gridline position.

setDomainGridlinePosition

public void setDomainGridlinePosition(CategoryAnchor position)
Sets the position used for the domain gridlines.

Parameters:
position - the position.

getDomainGridlineStroke

public java.awt.Stroke getDomainGridlineStroke()
Returns the stroke used to draw grid-lines against the domain axis.

Returns:
the stroke.

setDomainGridlineStroke

public void setDomainGridlineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw grid-lines against the domain axis. A PlotChangeEvent is sent to all registered listeners.

Parameters:
stroke - the stroke.

getDomainGridlinePaint

public java.awt.Paint getDomainGridlinePaint()
Returns the paint used to draw grid-lines against the domain axis.

Returns:
the paint.

setDomainGridlinePaint

public void setDomainGridlinePaint(java.awt.Paint paint)
Sets the paint used to draw the grid-lines (if any) against the domain axis. A PlotChangeEvent is sent to all registered listeners.

Parameters:
paint - the paint.

isRangeGridlinesVisible

public boolean isRangeGridlinesVisible()
Returns the flag that controls whether the range grid-lines are visible.

Returns:
the flag.

setRangeGridlinesVisible

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.

getRangeGridlineStroke

public java.awt.Stroke getRangeGridlineStroke()
Returns the stroke used to draw the grid-lines against the range axis.

Returns:
the stroke.

setRangeGridlineStroke

public void setRangeGridlineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the grid-lines against the range axis. A PlotChangeEvent is sent to all registered listeners.

Parameters:
stroke - the stroke.

getRangeGridlinePaint

public java.awt.Paint getRangeGridlinePaint()
Returns the paint used to draw the grid-lines against the range axis.

Returns:
the paint.

setRangeGridlinePaint

public void setRangeGridlinePaint(java.awt.Paint paint)
Sets the paint used to draw the grid lines against the range axis. A PlotChangeEvent is sent to all registered listeners.

Parameters:
paint - the paint.

getLegendItems

public LegendItemCollection getLegendItems()
Returns the legend items for the plot. By default, this method creates a legend item for each series in the primary and secondary datasets. You can change this behaviour by overriding this method.

Overrides:
getLegendItems in class Plot
Returns:
the legend items.

handleClick

public void handleClick(int x,
                        int y,
                        PlotRenderingInfo info)
Handles a 'click' on the plot by updating the anchor value.

Overrides:
handleClick in class 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.

zoom

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

Overrides:
zoom in class Plot
Parameters:
percent - the zoom amount.

datasetChanged

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 class Plot
Parameters:
event - information about the event (not used here).

rendererChanged

public void rendererChanged(RendererChangeEvent event)
Receives notification of a renderer change event.

Specified by:
rendererChanged in interface RendererChangeListener
Parameters:
event - the event.

addRangeMarker

public void addRangeMarker(Marker marker)
Adds a marker for display against the range axis.

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.

addRangeMarker

public void addRangeMarker(Marker marker,
                           org.jfree.ui.Layer layer)
Adds a marker for display against the range axis.

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.
layer - the layer (foreground or background).

clearRangeMarkers

public void clearRangeMarkers()
Clears all the range markers for the plot.


getRangeMarkers

public java.util.List getRangeMarkers()
Deprecated. Use getRangeMarkers(Layer).

Returns the list of range markers (read only).

Returns:
The list of range markers.

getRangeMarkers

public java.util.List getRangeMarkers(org.jfree.ui.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.

addSecondaryRangeMarker

public void addSecondaryRangeMarker(Marker marker)
Deprecated. Use addSecondaryRangeMarker(int, Marker, Layer).

Adds a marker for display against the secondary range axis.

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.

addSecondaryRangeMarker

public void addSecondaryRangeMarker(int index,
                                    Marker marker,
                                    org.jfree.ui.Layer layer)
Adds a marker for display against the secondary range axis.

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:
index - the secondary axis index.
marker - the marker.
layer - the layer.

clearSecondaryRangeMarkers

public void clearSecondaryRangeMarkers()
Deprecated. Use clearSecondaryRangeMarkers(int).

Clears all the secondary range markers for the plot.


clearSecondaryRangeMarkers

public void clearSecondaryRangeMarkers(int index)
Clears all the secondary range markers for the plot.

Parameters:
index - the secondary axis index.

getSecondaryRangeMarkers

public java.util.List getSecondaryRangeMarkers()
Deprecated. Use getSecondaryRangeMarkers(int, Layer), and note that it returns a Collection rather than a List.

Returns the list of secondary range markers (read only).

Returns:
The list of secondary range markers.

getSecondaryRangeMarkers

public java.util.Collection getSecondaryRangeMarkers(int index,
                                                     org.jfree.ui.Layer layer)
Returns a collection of secondary range markers for a particular axis and layer.

Parameters:
index - the secondary axis index.
layer - the layer.
Returns:
A collection of markers (possibly null).

isRangeCrosshairVisible

public boolean isRangeCrosshairVisible()
Returns a flag indicating whether or not the range crosshair is visible.

Returns:
the flag.

setRangeCrosshairVisible

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.

isRangeCrosshairLockedOnData

public boolean isRangeCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.

Returns:
the flag.

setRangeCrosshairLockedOnData

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.

getRangeCrosshairValue

public double getRangeCrosshairValue()
Returns the range crosshair value.

Returns:
The value.

setRangeCrosshairValue

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.

setRangeCrosshairValue

public void setRangeCrosshairValue(double value,
                                   boolean notify)
Sets the range crosshair value.

Registered listeners are notified that the axis has been modified, but only if the crosshair is visible.

Parameters:
value - the new value.
notify - a flag that controls whether or not listeners are notified.

getRangeCrosshairStroke

public java.awt.Stroke getRangeCrosshairStroke()
Returns the pen-style (Stroke) used to draw the crosshair (if visible).

Returns:
the crosshair stroke.

setRangeCrosshairStroke

public void setRangeCrosshairStroke(java.awt.Stroke stroke)
Sets the pen-style (Stroke) used to draw the crosshairs (if visible). A PlotChangeEvent is sent to all registered listeners.

Parameters:
stroke - the new crosshair stroke.

getRangeCrosshairPaint

public java.awt.Paint getRangeCrosshairPaint()
Returns the range crosshair color.

Returns:
the crosshair color.

setRangeCrosshairPaint

public void setRangeCrosshairPaint(java.awt.Paint paint)
Sets the Paint used to color the crosshairs (if visible) and notifies registered listeners that the axis has been modified.

Parameters:
paint - the new crosshair paint.

getAnnotations

public java.util.List getAnnotations()
Returns the list of annotations.

Returns:
The list of annotations.

addAnnotation

public void addAnnotation(CategoryAnnotation annotation)
Adds an annotation to the plot.

Parameters:
annotation - the annotation.

calculateDomainAxisSpace

protected AxisSpace calculateDomainAxisSpace(java.awt.Graphics2D g2,
                                             java.awt.geom.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.

calculateRangeAxisSpace

protected AxisSpace calculateRangeAxisSpace(java.awt.Graphics2D g2,
                                            java.awt.geom.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.

calculateAxisSpace

protected AxisSpace calculateAxisSpace(java.awt.Graphics2D g2,
                                       java.awt.geom.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.

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.Rectangle2D plotArea,
                 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.

Specified by:
draw in class Plot
Parameters:
g2 - the graphics device.
plotArea - the area within which the plot (including axes) should be drawn.
parentState - the state from the parent plot, if there is one.
state - collects info as the chart is drawn.

drawAxes

protected java.util.Map drawAxes(java.awt.Graphics2D g2,
                                 java.awt.geom.Rectangle2D plotArea,
                                 java.awt.geom.Rectangle2D dataArea)
A utility method for drawing the plot's axes.

Parameters:
g2 - the graphics device.
plotArea - the plot area.
dataArea - the data area.
Returns:
A map containing the axis states.

render

public void render(java.awt.Graphics2D g2,
                   java.awt.geom.Rectangle2D dataArea,
                   PlotRenderingInfo info)
Draws a representation of the data within the dataArea region, using the current renderer.

Parameters:
g2 - the graphics device.
dataArea - the region in which the data is to be drawn.
info - an optional object for collection dimension information.

render2

public void render2(java.awt.Graphics2D g2,
                    java.awt.geom.Rectangle2D dataArea,
                    PlotRenderingInfo info)
Draws a representation of the data in the secondary dataset(s) within the dataArea region, using the current renderer.

Parameters:
g2 - the graphics device.
dataArea - the region in which the data is to be drawn.
info - an optional object for collection dimension information.

drawDomainGridlines

protected void drawDomainGridlines(java.awt.Graphics2D g2,
                                   java.awt.geom.Rectangle2D dataArea)
Draws the gridlines for the plot.

Parameters:
g2 - the graphics device.
dataArea - the area inside the axes.

drawRangeGridlines

protected void drawRangeGridlines(java.awt.Graphics2D g2,
                                  java.awt.geom.Rectangle2D dataArea,
                                  java.util.List ticks)
Draws the gridlines for the plot.

Parameters:
g2 - the graphics device.
dataArea - the area inside the axes.
ticks - the ticks.

drawAnnotations

protected void drawAnnotations(java.awt.Graphics2D g2,
                               java.awt.geom.Rectangle2D dataArea)
Draws the annotations...

Parameters:
g2 - the graphics device.
dataArea - the data area.

drawRangeMarkers

protected void drawRangeMarkers(java.awt.Graphics2D g2,
                                java.awt.geom.Rectangle2D dataArea,
                                org.jfree.ui.Layer layer)
Draws the range markers (if any) for the specified layer. This method is typically called from within the draw(...) method.

Parameters:
g2 - the graphics device.
dataArea - the data area.
layer - the layer (foreground or background).

drawSecondaryRangeMarkers

protected void drawSecondaryRangeMarkers(java.awt.Graphics2D g2,
                                         java.awt.geom.Rectangle2D dataArea)
Deprecated. Use drawSecondaryRangeMarkers(g2, dataArea, int, Layer).

Draws the secondary range markers (if any). This method is typically called from within the draw(...) method.

Parameters:
g2 - the graphics device.
dataArea - the data area.

drawSecondaryRangeMarkers

protected void drawSecondaryRangeMarkers(java.awt.Graphics2D g2,
                                         java.awt.geom.Rectangle2D dataArea,
                                         int index,
                                         org.jfree.ui.Layer layer)
Draws the secondary 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 secondary axis index.
layer - the layer (foreground or background).

drawRangeLine

protected void drawRangeLine(java.awt.Graphics2D g2,
                             java.awt.geom.Rectangle2D dataArea,
                             double value,
                             java.awt.Stroke stroke,
                             java.awt.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.
paint - the line paint.

getDataRange

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.

Specified by:
getDataRange in interface ValueAxisPlot
Parameters:
axis - the axis.
Returns:
The data range.

getWeight

public int getWeight()
Returns the weight for this plot when it is used as a subplot within a combined plot.

Returns:
the weight.

setWeight

public void setWeight(int weight)
Sets the weight for the plot.

Parameters:
weight - the weight.

getFixedDomainAxisSpace

public AxisSpace getFixedDomainAxisSpace()
Returns the fixed domain axis space.

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

setFixedDomainAxisSpace

public void setFixedDomainAxisSpace(AxisSpace space)
Sets the fixed domain axis space.

Parameters:
space - the space.

getFixedRangeAxisSpace

public AxisSpace getFixedRangeAxisSpace()
Returns the fixed range axis space.

Returns:
The fixed range axis space.

setFixedRangeAxisSpace

public void setFixedRangeAxisSpace(AxisSpace space)
Sets the fixed range axis space.

Parameters:
space - the space.

getCategories

public java.util.List getCategories()
Returns a list of the categories for the plot.

Returns:
A list of the categories for the plot.

getDrawSharedDomainAxis

public boolean getDrawSharedDomainAxis()
Returns the flag that controls whether or not the shared domain axis is drawn for each subplot.

Returns:
A boolean.

zoomHorizontalAxes

public void zoomHorizontalAxes(double factor)
Multiplies the range on the horizontal axis/axes by the specified factor.

Specified by:
zoomHorizontalAxes in interface ValueAxisPlot
Parameters:
factor - the zoom factor.

zoomHorizontalAxes

public void zoomHorizontalAxes(double lowerPercent,
                               double upperPercent)
Zooms in on the horizontal axes.

Specified by:
zoomHorizontalAxes in interface ValueAxisPlot
Parameters:
lowerPercent - the lower bound.
upperPercent - the upper bound.

zoomVerticalAxes

public void zoomVerticalAxes(double factor)
Multiplies the range on the vertical axis/axes by the specified factor.

Specified by:
zoomVerticalAxes in interface ValueAxisPlot
Parameters:
factor - the zoom factor.

zoomVerticalAxes

public void zoomVerticalAxes(double lowerPercent,
                             double upperPercent)
Zooms in on the vertical axes.

Specified by:
zoomVerticalAxes in interface ValueAxisPlot
Parameters:
lowerPercent - the lower bound.
upperPercent - the upper bound.

getAnchorValue

public double getAnchorValue()
Returns the anchor value.

Returns:
The anchor value.

setAnchorValue

public void setAnchorValue(double value)
Sets the anchor value.

Parameters:
value - the anchor value.

setAnchorValue

public void setAnchorValue(double value,
                           boolean notify)
Sets the anchor value.

Parameters:
value - the value.
notify - notify listeners?

equals

public boolean equals(java.lang.Object object)
Tests the plot for equality with an arbitrary object.

Overrides:
equals in class Plot
Parameters:
object - the object to test against.
Returns:
true or false.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the plot.

Specified by:
clone in interface org.jfree.util.PublicCloneable
Overrides:
clone in class Plot
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if the cloning is not supported.