Class XYPlot
- java.lang.Object
-
- org.jfree.chart.plot.Plot
-
- org.jfree.chart.plot.XYPlot
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,AnnotationChangeListener
,AxisChangeListener
,MarkerChangeListener
,RendererChangeListener
,LegendItemSource
,Pannable
,ValueAxisPlot
,Zoomable
,PublicCloneable
,DatasetChangeListener
- Direct Known Subclasses:
CombinedDomainXYPlot
,CombinedRangeXYPlot
public class XYPlot extends Plot implements ValueAxisPlot, Pannable, Zoomable, RendererChangeListener, java.lang.Cloneable, PublicCloneable, java.io.Serializable
A general class for plotting data in the form of (x, y) pairs. This plot can use data from any class that implements theXYDataset
interface.XYPlot
makes use of anXYItemRenderer
to draw each point on the plot. By using different renderers, various chart types can be produced.The
ChartFactory
class contains static methods for creating pre-configured charts.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<XYAnnotation>
annotations
A (possibly empty) list of annotations for the plot.private RectangleInsets
axisOffset
The offset between the data area and the axes.private java.util.Map<java.lang.Integer,java.util.List<Marker>>
backgroundDomainMarkers
A map of lists of background markers (optional) for the domain axes.private java.util.Map<java.lang.Integer,java.util.List<Marker>>
backgroundRangeMarkers
A map of lists of background markers (optional) for the range axes.private DatasetRenderingOrder
datasetRenderingOrder
The order of the dataset rendering (REVERSE draws the primary dataset last so that it appears to be on top).private java.util.Map<java.lang.Integer,XYDataset>
datasets
Storage for the datasets.private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>
datasetToDomainAxesMap
Storage for the mapping between datasets/renderers and domain axes.private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>
datasetToRangeAxesMap
Storage for the mapping between datasets/renderers and range axes.static java.awt.Paint
DEFAULT_CROSSHAIR_PAINT
The default crosshair paint.static java.awt.Stroke
DEFAULT_CROSSHAIR_STROKE
The default crosshair stroke.static boolean
DEFAULT_CROSSHAIR_VISIBLE
The default crosshair visibility.static java.awt.Paint
DEFAULT_GRIDLINE_PAINT
The default grid line paint.static java.awt.Stroke
DEFAULT_GRIDLINE_STROKE
The default grid line stroke.private java.util.Map<java.lang.Integer,ValueAxis>
domainAxes
The domain axis / axes (used for the x-values).private java.util.Map<java.lang.Integer,AxisLocation>
domainAxisLocations
The domain axis locations.private boolean
domainCrosshairLockedOnData
A flag that controls whether or not the crosshair locks onto actual data points.private java.awt.Paint
domainCrosshairPaint
The color used to draw the crosshair (if any).private java.awt.Stroke
domainCrosshairStroke
The pen/brush used to draw the crosshair (if any).private double
domainCrosshairValue
The domain crosshair value.private boolean
domainCrosshairVisible
A flag that controls whether or not a domain crosshair is drawn..private java.awt.Paint
domainGridlinePaint
The paint used to draw the domain grid-lines.private java.awt.Stroke
domainGridlineStroke
The stroke used to draw the domain grid-lines.private boolean
domainGridlinesVisible
A flag that controls whether the domain grid-lines are visible.private java.awt.Paint
domainMinorGridlinePaint
The paint used to draw the domain minor grid-lines.private java.awt.Stroke
domainMinorGridlineStroke
The stroke used to draw the domain minor grid-lines.private boolean
domainMinorGridlinesVisible
A flag that controls whether the domain minor grid-lines are visible.private boolean
domainPannable
A flag that controls whether or not panning is enabled for the domain axis/axes.private java.awt.Paint
domainTickBandPaint
The paint used for the domain tick bands (if any).private java.awt.Paint
domainZeroBaselinePaint
The paint used for the zero baseline against the domain axis.private java.awt.Stroke
domainZeroBaselineStroke
The stroke used for the zero baseline against the domain axis.private boolean
domainZeroBaselineVisible
A flag that controls whether or not the zero baseline against the domain axis is visible.private AxisSpace
fixedDomainAxisSpace
The fixed domain axis space.private LegendItemCollection
fixedLegendItems
An optional collection of legend items that can be returned by the getLegendItems() method.private AxisSpace
fixedRangeAxisSpace
The fixed range axis space.private java.util.Map<java.lang.Integer,java.util.List<Marker>>
foregroundDomainMarkers
A map of lists of foreground markers (optional) for the domain axes.private java.util.Map<java.lang.Integer,java.util.List<Marker>>
foregroundRangeMarkers
A map of lists of foreground markers (optional) for the range axes.protected static java.util.ResourceBundle
localizationResources
The resourceBundle for the localization.private PlotOrientation
orientation
The plot orientation.private java.awt.geom.Point2D
quadrantOrigin
The origin point for the quadrants (if drawn).private java.awt.Paint[]
quadrantPaint
The paint used for each quadrant.private java.util.Map<java.lang.Integer,ValueAxis>
rangeAxes
The range axis (used for the y-values).private java.util.Map<java.lang.Integer,AxisLocation>
rangeAxisLocations
The range axis location.private boolean
rangeCrosshairLockedOnData
A flag that controls whether or not the crosshair locks onto actual data points.private java.awt.Paint
rangeCrosshairPaint
The color used to draw the crosshair (if any).private java.awt.Stroke
rangeCrosshairStroke
The pen/brush used to draw the crosshair (if any).private double
rangeCrosshairValue
The range crosshair value.private boolean
rangeCrosshairVisible
A flag that controls whether or not a range crosshair is drawn..private java.awt.Paint
rangeGridlinePaint
The paint used to draw the range grid-lines.private java.awt.Stroke
rangeGridlineStroke
The stroke used to draw the range grid-lines.private boolean
rangeGridlinesVisible
A flag that controls whether the range grid-lines are visible.private java.awt.Paint
rangeMinorGridlinePaint
The paint used to draw the range minor grid-lines.private java.awt.Stroke
rangeMinorGridlineStroke
The stroke used to draw the range minor grid-lines.private boolean
rangeMinorGridlinesVisible
A flag that controls whether the range minor grid-lines are visible.private boolean
rangePannable
A flag that controls whether or not panning is enabled for the range axis/axes.private java.awt.Paint
rangeTickBandPaint
The paint used for the range tick bands (if any).private java.awt.Paint
rangeZeroBaselinePaint
The paint used for the zero baseline against the range axis.private java.awt.Stroke
rangeZeroBaselineStroke
The stroke used for the zero baseline against the range axis.private boolean
rangeZeroBaselineVisible
A flag that controls whether or not the zero baseline against the range axis is visible.private java.util.Map<java.lang.Integer,XYItemRenderer>
renderers
Storage for the renderers.private static long
serialVersionUID
For serialization.private SeriesRenderingOrder
seriesRenderingOrder
The order of the series rendering (REVERSE draws the primary series last so that it appears to be on top).private ShadowGenerator
shadowGenerator
The shadow generator (null
permitted).private int
weight
The weight for this plot (only relevant if this is a subplot in a combined plot).-
Fields inherited from class org.jfree.chart.plot.Plot
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_LEGEND_ITEM_BOX, DEFAULT_LEGEND_ITEM_CIRCLE, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(XYAnnotation annotation)
Adds an annotation to the plot and sends aPlotChangeEvent
to all registered listeners.void
addAnnotation(XYAnnotation annotation, boolean notify)
Adds an annotation to the plot and, if requested, sends aPlotChangeEvent
to all registered listeners.void
addDomainMarker(int index, Marker marker, Layer layer)
Adds a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.void
addDomainMarker(int index, Marker marker, Layer layer, boolean notify)
Adds a marker for a specific dataset/renderer and, if requested, sends aPlotChangeEvent
to all registered listeners.void
addDomainMarker(Marker marker)
Adds a marker for the domain axis and sends aPlotChangeEvent
to all registered listeners.void
addDomainMarker(Marker marker, Layer layer)
Adds a marker for the domain axis in the specified layer and sends aPlotChangeEvent
to all registered listeners.void
addRangeMarker(int index, Marker marker, Layer layer)
Adds a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.void
addRangeMarker(int index, Marker marker, Layer layer, boolean notify)
Adds a marker for a specific dataset/renderer and, if requested, sends aPlotChangeEvent
to all registered listeners.void
addRangeMarker(Marker marker)
Adds a marker for the range axis and sends aPlotChangeEvent
to all registered listeners.void
addRangeMarker(Marker marker, Layer layer)
Adds a marker for the range axis in the specified layer and sends aPlotChangeEvent
to all registered listeners.void
annotationChanged(AnnotationChangeEvent event)
Receives notification of a change to anAnnotation
added to this plot.protected AxisSpace
calculateAxisSpace(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea)
Calculates the space required for all the axes in the plot.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.private void
checkAxisIndices(java.util.List<java.lang.Integer> indices)
This method is used to perform argument checking on the list of axis indices passed to mapDatasetToDomainAxes() and mapDatasetToRangeAxes().void
clearAnnotations()
Clears all the annotations and sends aPlotChangeEvent
to all registered listeners.void
clearDomainAxes()
Clears the domain axes from the plot and sends aPlotChangeEvent
to all registered listeners.void
clearDomainMarkers()
Clears all the (foreground and background) domain markers and sends aPlotChangeEvent
to all registered listeners.void
clearDomainMarkers(int index)
Clears the (foreground and background) domain markers for a particular renderer and sends aPlotChangeEvent
to all registered listeners.void
clearRangeAxes()
Clears the range axes from the plot and sends aPlotChangeEvent
to all registered listeners.void
clearRangeMarkers()
Clears all the range markers and sends aPlotChangeEvent
to all registered listeners.void
clearRangeMarkers(int index)
Clears the (foreground and background) range markers for a particular renderer.java.lang.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(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the plot within the specified area on a graphics device.void
drawAnnotations(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info)
Draws the annotations for the plot.protected java.util.Map<Axis,AxisState>
drawAxes(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo plotState)
A utility method for drawing the axes.void
drawBackground(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws the background for the plot.protected void
drawDomainCrosshair(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotOrientation orientation, double value, ValueAxis axis, java.awt.Stroke stroke, java.awt.Paint paint)
Draws a domain crosshair.protected void
drawDomainGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List<ValueTick> ticks)
Draws the gridlines for the plot, if they are visible.protected void
drawDomainMarkers(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, int index, Layer layer)
Draws the domain markers (if any) for an axis and layer.void
drawDomainTickBands(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List<ValueTick> ticks)
Draws the domain tick bands, if any.protected void
drawHorizontalLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Stroke stroke, java.awt.Paint paint)
Utility method for drawing a horizontal line across the data area of the plot.protected void
drawQuadrants(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws the quadrants.protected void
drawRangeCrosshair(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotOrientation orientation, double value, ValueAxis axis, java.awt.Stroke stroke, java.awt.Paint paint)
Draws a range crosshair.protected void
drawRangeGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.util.List<ValueTick> ticks)
Draws the gridlines for the plot's primary range axis, if they are visible.protected void
drawRangeMarkers(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, int index, Layer layer)
Draws the range markers (if any) for a renderer and layer.void
drawRangeTickBands(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List<ValueTick> ticks)
Draws the range tick bands, if any.protected void
drawVerticalLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Stroke stroke, java.awt.Paint paint)
Utility method for drawing a vertical line on the data area of the plot.protected void
drawZeroDomainBaseline(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws a base line across the chart at value zero on the domain axis.protected void
drawZeroRangeBaseline(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws a base line across the chart at value zero on the range axis.boolean
equals(java.lang.Object obj)
Tests this plot for equality with another object.private int
findDomainAxisIndex(ValueAxis axis)
private int
findRangeAxisIndex(ValueAxis axis)
java.util.List<XYAnnotation>
getAnnotations()
Returns the list of annotations.RectangleInsets
getAxisOffset()
Returns the axis offset.Range
getDataRange(ValueAxis axis)
Returns the range for the specified axis.XYDataset
getDataset()
Returns the primary dataset for the plot.XYDataset
getDataset(int index)
Returns the dataset with the specified index, ornull
if there is no dataset with that index.int
getDatasetCount()
Returns the number of datasets.private java.util.List<java.lang.Integer>
getDatasetIndices(DatasetRenderingOrder order)
Returns the indices of the non-null datasets in the specified order.DatasetRenderingOrder
getDatasetRenderingOrder()
Returns the dataset rendering order.java.util.Map<java.lang.Integer,XYDataset>
getDatasets()
Returns a map containing the datasets that are assigned to this plot.private java.util.List<XYDataset>
getDatasetsMappedToDomainAxis(java.lang.Integer axisIndex)
A utility method that returns a list of datasets that are mapped to a particular axis.private java.util.List<XYDataset>
getDatasetsMappedToRangeAxis(java.lang.Integer axisIndex)
A utility method that returns a list of datasets that are mapped to a particular axis.java.util.Map<java.lang.Integer,ValueAxis>
getDomainAxes()
Returns a map containing the domain axes that are assigned to this plot.ValueAxis
getDomainAxis()
Returns the domain axis with index 0.ValueAxis
getDomainAxis(int index)
Returns the domain axis with the specified index, ornull
if there is no axis with that index.int
getDomainAxisCount()
Returns the number of domain axes.RectangleEdge
getDomainAxisEdge()
Returns the edge for the primary domain axis (taking into account the plot's orientation).RectangleEdge
getDomainAxisEdge(int index)
Returns the edge for a domain axis.ValueAxis
getDomainAxisForDataset(int index)
Returns the domain axis for a dataset.int
getDomainAxisIndex(ValueAxis axis)
Returns the index of the given domain axis.AxisLocation
getDomainAxisLocation()
Returns the location of the primary domain axis.AxisLocation
getDomainAxisLocation(int index)
Returns the location for a domain axis.java.awt.Paint
getDomainCrosshairPaint()
Returns the domain crosshair paint.java.awt.Stroke
getDomainCrosshairStroke()
Returns theStroke
used to draw the crosshair (if visible).double
getDomainCrosshairValue()
Returns the domain crosshair value.java.awt.Paint
getDomainGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the domain axis.java.awt.Stroke
getDomainGridlineStroke()
Returns the stroke for the grid-lines (if any) plotted against the domain axis.java.util.Collection<Marker>
getDomainMarkers(int index, Layer layer)
Returns a collection of domain markers for a particular renderer and layer.java.util.Collection
getDomainMarkers(Layer layer)
Returns the list of domain markers (read only) for the specified layer.java.awt.Paint
getDomainMinorGridlinePaint()
Returns the paint for the minor grid lines (if any) plotted against the domain axis.java.awt.Stroke
getDomainMinorGridlineStroke()
Returns the stroke for the minor grid-lines (if any) plotted against the domain axis.java.awt.Paint
getDomainTickBandPaint()
Returns the paint used for the domain tick bands.java.awt.Paint
getDomainZeroBaselinePaint()
Returns the paint for the zero baseline (if any) plotted against the domain axis.java.awt.Stroke
getDomainZeroBaselineStroke()
Returns the stroke used for the zero baseline against the domain axis.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(XYItemRenderer 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.java.lang.String
getPlotType()
Returns the plot type as a string.java.awt.geom.Point2D
getQuadrantOrigin()
Returns the origin for the quadrants that can be displayed on the plot.java.awt.Paint
getQuadrantPaint(int index)
Returns the paint used for the specified quadrant.java.util.Map<java.lang.Integer,ValueAxis>
getRangeAxes()
Returns a map containing the range axes that are assigned to this plot.ValueAxis
getRangeAxis()
Returns the range axis for the plot.ValueAxis
getRangeAxis(int index)
Returns the range axis with the specified index, ornull
if there is no axis with that index.int
getRangeAxisCount()
Returns the number of range axes.RectangleEdge
getRangeAxisEdge()
Returns the edge for the primary range axis.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 given range axis.AxisLocation
getRangeAxisLocation()
Returns the location of the primary range axis.AxisLocation
getRangeAxisLocation(int index)
Returns the location for a range axis.java.awt.Paint
getRangeCrosshairPaint()
Returns the range crosshair paint.java.awt.Stroke
getRangeCrosshairStroke()
Returns the stroke used to draw the crosshair (if visible).double
getRangeCrosshairValue()
Returns the range crosshair value.java.awt.Paint
getRangeGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the range axis.java.awt.Stroke
getRangeGridlineStroke()
Returns the stroke for the grid lines (if any) plotted against the range axis.java.util.Collection<Marker>
getRangeMarkers(int index, Layer layer)
Returns a collection of range markers for a particular renderer and layer.java.util.Collection<Marker>
getRangeMarkers(Layer layer)
Returns the list of range markers (read only) for the specified layer.java.awt.Paint
getRangeMinorGridlinePaint()
Returns the paint for the minor grid lines (if any) plotted against the range axis.java.awt.Stroke
getRangeMinorGridlineStroke()
Returns the stroke for the minor grid lines (if any) plotted against the range axis.java.awt.Paint
getRangeTickBandPaint()
Returns the paint used for the range tick bands.java.awt.Paint
getRangeZeroBaselinePaint()
Returns the paint for the zero baseline (if any) plotted against the range axis.java.awt.Stroke
getRangeZeroBaselineStroke()
Returns the stroke used for the zero baseline against the range axis.XYItemRenderer
getRenderer()
Returns the renderer for the primary dataset.XYItemRenderer
getRenderer(int index)
Returns the renderer with the specified index, ornull
.int
getRendererCount()
Returns the number of renderer slots for this plot.XYItemRenderer
getRendererForDataset(XYDataset dataset)
Returns the renderer for the specified dataset (this is either the renderer with the same index as the dataset or, if there isn't a renderer with the same index, the default renderer).private java.util.List<java.lang.Integer>
getRendererIndices(DatasetRenderingOrder order)
java.util.Map<java.lang.Integer,XYItemRenderer>
getRenderers()
Returns a map containing the renderers that are assigned to this plot.int
getSeriesCount()
Returns the number of series in the primary dataset for this plot.SeriesRenderingOrder
getSeriesRenderingOrder()
Returns the series rendering order.ShadowGenerator
getShadowGenerator()
Returns the shadow generator for the plot, if any.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 values.int
indexOf(XYDataset dataset)
Returns the index of the specified dataset, or-1
if the dataset does not belong to the plot.private java.awt.Rectangle
integerise(java.awt.geom.Rectangle2D rect)
Trims a rectangle to integer coordinates.boolean
isDomainCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.boolean
isDomainCrosshairVisible()
Returns a flag indicating whether or not the domain crosshair is visible.boolean
isDomainGridlinesVisible()
Returnstrue
if the domain gridlines are visible, andfalse
otherwise.boolean
isDomainMinorGridlinesVisible()
Returnstrue
if the domain minor gridlines are visible, andfalse
otherwise.boolean
isDomainPannable()
Returnstrue
if panning is enabled for the domain axes, andfalse
otherwise.boolean
isDomainZeroBaselineVisible()
Returns a flag that controls whether or not a zero baseline is displayed for the domain axis.boolean
isDomainZoomable()
Returnstrue
, indicating that the domain axis/axes for this plot are 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()
Returnstrue
if the range axis grid is visible, andfalse
otherwise.boolean
isRangeMinorGridlinesVisible()
Returnstrue
if the range axis minor grid is visible, andfalse
otherwise.boolean
isRangePannable()
Returnstrue
if panning is enabled for the range axis/axes, andfalse
otherwise.boolean
isRangeZeroBaselineVisible()
Returns a flag that controls whether or not a zero baseline is displayed for the range axis.boolean
isRangeZoomable()
Returnstrue
, indicating that the range axis/axes for this plot are zoomable.void
mapDatasetToDomainAxes(int index, java.util.List<java.lang.Integer> 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, java.util.List<java.lang.Integer> 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, java.awt.geom.Point2D source)
Pans the domain axes by the specified percentage.void
panRangeAxes(double percent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Pans the range axes by the specified percentage.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.boolean
removeAnnotation(XYAnnotation annotation)
Removes an annotation from the plot and sends aPlotChangeEvent
to all registered listeners.boolean
removeAnnotation(XYAnnotation annotation, boolean notify)
Removes an annotation from the plot and sends aPlotChangeEvent
to all registered listeners.boolean
removeDomainMarker(int index, Marker marker, Layer layer)
Removes a marker for a specific dataset/renderer and sends aPlotChangeEvent
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 aPlotChangeEvent
to all registered listeners.boolean
removeDomainMarker(Marker marker)
Removes a marker for the domain axis and sends aPlotChangeEvent
to all registered listeners.boolean
removeDomainMarker(Marker marker, Layer layer)
Removes a marker for the domain axis in the specified layer and sends aPlotChangeEvent
to all registered listeners.boolean
removeRangeMarker(int index, Marker marker, Layer layer)
Removes a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.boolean
removeRangeMarker(int index, Marker marker, Layer layer, boolean notify)
Removes a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.boolean
removeRangeMarker(Marker marker)
Removes a marker for the range axis and sends aPlotChangeEvent
to all registered listeners.boolean
removeRangeMarker(Marker marker, Layer layer)
Removes a marker for the range axis in the specified layer and sends aPlotChangeEvent
to all registered listeners.boolean
render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, int index, PlotRenderingInfo info, CrosshairState crosshairState)
Draws a representation of the data within the dataArea region, using the current renderer.void
rendererChanged(RendererChangeEvent event)
Receives notification of a renderer change event.void
setAxisOffset(RectangleInsets offset)
Sets the axis offsets (gap between the data area and the axes) and sends aPlotChangeEvent
to all registered listeners.void
setDataset(int index, XYDataset dataset)
Sets a dataset for the plot and sends a change event to all registered listeners.void
setDataset(XYDataset dataset)
Sets the primary dataset for the plot, replacing the existing dataset if there is one.void
setDatasetRenderingOrder(DatasetRenderingOrder order)
Sets the rendering order and sends aPlotChangeEvent
to all registered listeners.void
setDomainAxes(ValueAxis[] axes)
Sets the domain axes for this plot and sends aPlotChangeEvent
to all registered listeners.void
setDomainAxis(int index, ValueAxis axis)
Sets a domain axis and sends aPlotChangeEvent
to all registered listeners.void
setDomainAxis(int index, ValueAxis axis, boolean notify)
Sets a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setDomainAxis(ValueAxis axis)
Sets the domain axis for the plot and sends aPlotChangeEvent
to all registered listeners.void
setDomainAxisLocation(int index, AxisLocation location)
Sets the location for a domain axis and sends aPlotChangeEvent
to all registered listeners.void
setDomainAxisLocation(int index, AxisLocation location, boolean notify)
Sets the axis location for a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setDomainAxisLocation(AxisLocation location)
Sets the location of the primary domain axis and sends aPlotChangeEvent
to all registered listeners.void
setDomainAxisLocation(AxisLocation location, boolean notify)
Sets the location of the domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setDomainCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the domain crosshair should "lock-on" to actual data values.void
setDomainCrosshairPaint(java.awt.Paint paint)
Sets the paint used to draw the crosshairs (if visible) and sends aPlotChangeEvent
to all registered listeners.void
setDomainCrosshairStroke(java.awt.Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.void
setDomainCrosshairValue(double value)
Sets the domain crosshair value and sends aPlotChangeEvent
to all registered listeners (provided that the domain crosshair is visible).void
setDomainCrosshairValue(double value, boolean notify)
Sets the domain crosshair value and, if requested, sends aPlotChangeEvent
to all registered listeners (provided that the domain crosshair is visible).void
setDomainCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the domain crosshair is visible and, if the flag changes, sends aPlotChangeEvent
to all registered listeners.void
setDomainGridlinePaint(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.void
setDomainGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.void
setDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the domain grid-lines are visible.void
setDomainMinorGridlinePaint(java.awt.Paint paint)
Sets the paint for the minor grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.void
setDomainMinorGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the minor grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.void
setDomainMinorGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the domain minor grid-lines are visible.void
setDomainPannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along the domain axes.void
setDomainTickBandPaint(java.awt.Paint paint)
Sets the paint for the domain tick bands.void
setDomainZeroBaselinePaint(java.awt.Paint paint)
Sets the paint for the zero baseline plotted against the domain axis and sends aPlotChangeEvent
to all registered listeners.void
setDomainZeroBaselineStroke(java.awt.Stroke stroke)
Sets the stroke for the zero baseline for the domain axis, and sends aPlotChangeEvent
to all registered listeners.void
setDomainZeroBaselineVisible(boolean visible)
Sets the flag that controls whether or not the zero baseline is displayed for the domain axis, and sends aPlotChangeEvent
to all registered listeners.void
setFixedDomainAxisSpace(AxisSpace space)
Sets the fixed domain axis space and sends aPlotChangeEvent
to all registered listeners.void
setFixedDomainAxisSpace(AxisSpace space, boolean notify)
Sets the fixed domain axis space and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setFixedLegendItems(LegendItemCollection items)
Sets the fixed legend items for the plot.void
setFixedRangeAxisSpace(AxisSpace space)
Sets the fixed range axis space and sends aPlotChangeEvent
to all registered listeners.void
setFixedRangeAxisSpace(AxisSpace space, boolean notify)
Sets the fixed range axis space and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setOrientation(PlotOrientation orientation)
Sets the orientation for the plot and sends aPlotChangeEvent
to all registered listeners.void
setQuadrantOrigin(java.awt.geom.Point2D origin)
Sets the quadrant origin and sends aPlotChangeEvent
to all registered listeners.void
setQuadrantPaint(int index, java.awt.Paint paint)
Sets the paint used for the specified quadrant and sends aPlotChangeEvent
to all registered listeners.void
setRangeAxes(ValueAxis[] axes)
Sets the range axes for this plot and sends aPlotChangeEvent
to all registered listeners.void
setRangeAxis(int index, ValueAxis axis)
Sets a range axis and sends aPlotChangeEvent
to all registered listeners.void
setRangeAxis(int index, ValueAxis axis, boolean notify)
Sets a range axis and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setRangeAxis(ValueAxis axis)
Sets the range axis for the plot and sends aPlotChangeEvent
to all registered listeners.void
setRangeAxisLocation(int index, AxisLocation location)
Sets the location for a range axis and sends aPlotChangeEvent
to all registered listeners.void
setRangeAxisLocation(int index, AxisLocation location, boolean notify)
Sets the axis location for a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setRangeAxisLocation(AxisLocation location)
Sets the location of the primary range axis and sends aPlotChangeEvent
to all registered listeners.void
setRangeAxisLocation(AxisLocation location, boolean notify)
Sets the location of the primary range axis and, if requested, sends aPlotChangeEvent
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.void
setRangeCrosshairPaint(java.awt.Paint paint)
Sets the paint used to color the crosshairs (if visible) and sends aPlotChangeEvent
to all registered listeners.void
setRangeCrosshairStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the crosshairs (if visible) and sends aPlotChangeEvent
to all registered listeners.void
setRangeCrosshairValue(double value)
Sets the range crosshair value.void
setRangeCrosshairValue(double value, boolean notify)
Sets the range crosshair value and sends aPlotChangeEvent
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(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the range axis and sends aPlotChangeEvent
to all registered listeners.void
setRangeGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis, and sends aPlotChangeEvent
to all registered listeners.void
setRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the range axis grid lines are visible.void
setRangeMinorGridlinePaint(java.awt.Paint paint)
Sets the paint for the minor grid lines plotted against the range axis and sends aPlotChangeEvent
to all registered listeners.void
setRangeMinorGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the minor grid lines plotted against the range axis, and sends aPlotChangeEvent
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 axis/axes.void
setRangeTickBandPaint(java.awt.Paint paint)
Sets the paint for the range tick bands.void
setRangeZeroBaselinePaint(java.awt.Paint paint)
Sets the paint for the zero baseline plotted against the range axis and sends aPlotChangeEvent
to all registered listeners.void
setRangeZeroBaselineStroke(java.awt.Stroke stroke)
Sets the stroke for the zero baseline for the range axis, and sends aPlotChangeEvent
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 aPlotChangeEvent
to all registered listeners.void
setRenderer(int index, XYItemRenderer renderer)
Sets the renderer for the dataset with the specified index and sends a change event to all registered listeners.void
setRenderer(int index, XYItemRenderer renderer, boolean notify)
Sets the renderer for the dataset with the specified index and, if requested, sends a change event to all registered listeners.void
setRenderer(XYItemRenderer renderer)
Sets the renderer for the primary dataset and sends a change event to all registered listeners.void
setRenderers(XYItemRenderer[] renderers)
Sets the renderers for this plot and sends aPlotChangeEvent
to all registered listeners.void
setSeriesRenderingOrder(SeriesRenderingOrder order)
Sets the series order and sends aPlotChangeEvent
to all registered listeners.void
setShadowGenerator(ShadowGenerator generator)
Sets the shadow generator for the plot and sends aPlotChangeEvent
to all registered listeners.void
setWeight(int weight)
Sets the weight for the plot and sends aPlotChangeEvent
to all registered listeners.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.void
zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Zooms in on the domain axis/axes.void
zoomDomainAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source)
Multiplies the range on the domain axis/axes by the specified factor.void
zoomDomainAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source, boolean useAnchor)
Multiplies the range on the domain axis/axes by the specified factor.void
zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Zooms in on the range axes.void
zoomRangeAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source)
Multiplies the range on the range axis/axes by the specified factor.void
zoomRangeAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source, boolean useAnchor)
Multiplies the range on the range axis/axes by the specified factor.-
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, axisChanged, canEqual, createAndAddEntity, drawBackgroundImage, drawNoDataMessage, drawOutline, fetchElementHintingFlag, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getChart, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, hashCode, isNotify, isOutlineVisible, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setChart, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- 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_CROSSHAIR_VISIBLE
public static final boolean DEFAULT_CROSSHAIR_VISIBLE
The default crosshair visibility.- See Also:
- Constant Field Values
-
DEFAULT_CROSSHAIR_STROKE
public static final java.awt.Stroke DEFAULT_CROSSHAIR_STROKE
The default crosshair stroke.
-
DEFAULT_CROSSHAIR_PAINT
public static final java.awt.Paint DEFAULT_CROSSHAIR_PAINT
The default crosshair paint.
-
localizationResources
protected static java.util.ResourceBundle localizationResources
The resourceBundle for the localization.
-
orientation
private PlotOrientation orientation
The plot orientation.
-
axisOffset
private RectangleInsets axisOffset
The offset between the data area and the axes.
-
domainAxes
private java.util.Map<java.lang.Integer,ValueAxis> domainAxes
The domain axis / axes (used for the x-values).
-
domainAxisLocations
private java.util.Map<java.lang.Integer,AxisLocation> domainAxisLocations
The domain axis locations.
-
rangeAxes
private java.util.Map<java.lang.Integer,ValueAxis> rangeAxes
The range axis (used for the y-values).
-
rangeAxisLocations
private java.util.Map<java.lang.Integer,AxisLocation> rangeAxisLocations
The range axis location.
-
datasets
private java.util.Map<java.lang.Integer,XYDataset> datasets
Storage for the datasets.
-
renderers
private java.util.Map<java.lang.Integer,XYItemRenderer> renderers
Storage for the renderers.
-
datasetToDomainAxesMap
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> datasetToDomainAxesMap
Storage for the mapping between datasets/renderers and domain axes. The keys in the map are Integer objects, corresponding to the dataset index. The values in the map are List objects containing Integer objects (corresponding to the axis indices). If the map contains no entry for a dataset, it is assumed to map to the primary domain axis (index = 0).
-
datasetToRangeAxesMap
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> datasetToRangeAxesMap
Storage for the mapping between datasets/renderers and range axes. The keys in the map are Integer objects, corresponding to the dataset index. The values in the map are List objects containing Integer objects (corresponding to the axis indices). If the map contains no entry for a dataset, it is assumed to map to the primary domain axis (index = 0).
-
quadrantOrigin
private transient java.awt.geom.Point2D quadrantOrigin
The origin point for the quadrants (if drawn).
-
quadrantPaint
private transient java.awt.Paint[] quadrantPaint
The paint used for each quadrant.
-
domainGridlinesVisible
private boolean domainGridlinesVisible
A flag that controls whether the domain grid-lines are visible.
-
domainGridlineStroke
private transient java.awt.Stroke domainGridlineStroke
The stroke used to draw the domain grid-lines.
-
domainGridlinePaint
private transient java.awt.Paint domainGridlinePaint
The paint used to draw the domain grid-lines.
-
rangeGridlinesVisible
private boolean rangeGridlinesVisible
A flag that controls whether the range grid-lines are visible.
-
rangeGridlineStroke
private transient java.awt.Stroke rangeGridlineStroke
The stroke used to draw the range grid-lines.
-
rangeGridlinePaint
private transient java.awt.Paint rangeGridlinePaint
The paint used to draw the range grid-lines.
-
domainMinorGridlinesVisible
private boolean domainMinorGridlinesVisible
A flag that controls whether the domain minor grid-lines are visible.
-
domainMinorGridlineStroke
private transient java.awt.Stroke domainMinorGridlineStroke
The stroke used to draw the domain minor grid-lines.
-
domainMinorGridlinePaint
private transient java.awt.Paint domainMinorGridlinePaint
The paint used to draw the domain minor grid-lines.
-
rangeMinorGridlinesVisible
private boolean rangeMinorGridlinesVisible
A flag that controls whether the range minor grid-lines are visible.
-
rangeMinorGridlineStroke
private transient java.awt.Stroke rangeMinorGridlineStroke
The stroke used to draw the range minor grid-lines.
-
rangeMinorGridlinePaint
private transient java.awt.Paint rangeMinorGridlinePaint
The paint used to draw the range minor grid-lines.
-
domainZeroBaselineVisible
private boolean domainZeroBaselineVisible
A flag that controls whether or not the zero baseline against the domain axis is visible.
-
domainZeroBaselineStroke
private transient java.awt.Stroke domainZeroBaselineStroke
The stroke used for the zero baseline against the domain axis.
-
domainZeroBaselinePaint
private transient java.awt.Paint domainZeroBaselinePaint
The paint used for the zero baseline against the domain axis.
-
rangeZeroBaselineVisible
private boolean rangeZeroBaselineVisible
A flag that controls whether or not the zero baseline against the range axis is visible.
-
rangeZeroBaselineStroke
private transient java.awt.Stroke rangeZeroBaselineStroke
The stroke used for the zero baseline against the range axis.
-
rangeZeroBaselinePaint
private transient java.awt.Paint rangeZeroBaselinePaint
The paint used for the zero baseline against the range axis.
-
domainCrosshairVisible
private boolean domainCrosshairVisible
A flag that controls whether or not a domain crosshair is drawn..
-
domainCrosshairValue
private double domainCrosshairValue
The domain crosshair value.
-
domainCrosshairStroke
private transient java.awt.Stroke domainCrosshairStroke
The pen/brush used to draw the crosshair (if any).
-
domainCrosshairPaint
private transient java.awt.Paint domainCrosshairPaint
The color used to draw the crosshair (if any).
-
domainCrosshairLockedOnData
private boolean domainCrosshairLockedOnData
A flag that controls whether or not the crosshair locks onto actual data points.
-
rangeCrosshairVisible
private boolean rangeCrosshairVisible
A flag that controls whether or not a range crosshair is drawn..
-
rangeCrosshairValue
private double rangeCrosshairValue
The range crosshair value.
-
rangeCrosshairStroke
private transient java.awt.Stroke rangeCrosshairStroke
The pen/brush used to draw the crosshair (if any).
-
rangeCrosshairPaint
private transient java.awt.Paint rangeCrosshairPaint
The color used to draw the crosshair (if any).
-
rangeCrosshairLockedOnData
private boolean rangeCrosshairLockedOnData
A flag that controls whether or not the crosshair locks onto actual data points.
-
foregroundDomainMarkers
private java.util.Map<java.lang.Integer,java.util.List<Marker>> foregroundDomainMarkers
A map of lists of foreground markers (optional) for the domain axes.
-
backgroundDomainMarkers
private java.util.Map<java.lang.Integer,java.util.List<Marker>> backgroundDomainMarkers
A map of lists of background markers (optional) for the domain axes.
-
foregroundRangeMarkers
private java.util.Map<java.lang.Integer,java.util.List<Marker>> foregroundRangeMarkers
A map of lists of foreground markers (optional) for the range axes.
-
backgroundRangeMarkers
private java.util.Map<java.lang.Integer,java.util.List<Marker>> backgroundRangeMarkers
A map of lists of background markers (optional) for the range axes.
-
annotations
private java.util.List<XYAnnotation> annotations
A (possibly empty) list of annotations for the plot. The list should be initialised in the constructor and never allowed to benull
.
-
domainTickBandPaint
private transient java.awt.Paint domainTickBandPaint
The paint used for the domain tick bands (if any).
-
rangeTickBandPaint
private transient java.awt.Paint rangeTickBandPaint
The paint used for the range tick bands (if any).
-
fixedDomainAxisSpace
private AxisSpace fixedDomainAxisSpace
The fixed domain axis space.
-
fixedRangeAxisSpace
private AxisSpace fixedRangeAxisSpace
The fixed range axis space.
-
datasetRenderingOrder
private DatasetRenderingOrder datasetRenderingOrder
The order of the dataset rendering (REVERSE draws the primary dataset last so that it appears to be on top).
-
seriesRenderingOrder
private SeriesRenderingOrder seriesRenderingOrder
The order of the series rendering (REVERSE draws the primary series last so that it appears to be on top).
-
weight
private int weight
The weight for this plot (only relevant if this is a subplot in a combined plot).
-
fixedLegendItems
private LegendItemCollection fixedLegendItems
An optional collection of legend items that can be returned by the getLegendItems() method.
-
domainPannable
private boolean domainPannable
A flag that controls whether or not panning is enabled for the domain axis/axes.
-
rangePannable
private boolean rangePannable
A flag that controls whether or not panning is enabled for the range axis/axes.
-
shadowGenerator
private ShadowGenerator shadowGenerator
The shadow generator (null
permitted).
-
-
Constructor Detail
-
XYPlot
public XYPlot()
Creates a newXYPlot
instance with no dataset, no axes and no renderer. You should specify these items before using the plot.
-
XYPlot
public XYPlot(XYDataset dataset, ValueAxis domainAxis, ValueAxis rangeAxis, XYItemRenderer renderer)
Creates a new plot with the specified dataset, axes and renderer. Any of the arguments can benull
, but in that case you should take care to specify the value before using the plot (otherwise aNullPointerException
may be thrown).- Parameters:
dataset
- the dataset (null
permitted).domainAxis
- the domain axis (null
permitted).rangeAxis
- the range axis (null
permitted).renderer
- the renderer (null
permitted).
-
-
Method Detail
-
getPlotType
public java.lang.String getPlotType()
Returns the plot type as a string.- Specified by:
getPlotType
in classPlot
- Returns:
- A short string describing the type of plot.
-
getOrientation
public PlotOrientation getOrientation()
Returns the orientation of the plot.- Specified by:
getOrientation
in interfacePannable
- Specified by:
getOrientation
in interfaceZoomable
- Returns:
- The orientation (never
null
). - See Also:
setOrientation(PlotOrientation)
-
setOrientation
public void setOrientation(PlotOrientation orientation)
Sets the orientation for the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
orientation
- the orientation (null
not allowed).- See Also:
getOrientation()
-
getAxisOffset
public RectangleInsets getAxisOffset()
Returns the axis offset.- Returns:
- The axis offset (never
null
). - See Also:
setAxisOffset(RectangleInsets)
-
setAxisOffset
public void setAxisOffset(RectangleInsets offset)
Sets the axis offsets (gap between the data area and the axes) and sends aPlotChangeEvent
to all registered listeners.- Parameters:
offset
- the offset (null
not permitted).- See Also:
getAxisOffset()
-
getDomainAxis
public ValueAxis getDomainAxis()
Returns the domain axis with index 0. If the domain axis for this plot isnull
, then the method will return the parent plot's domain axis (if there is a parent plot).- Returns:
- The domain axis (possibly
null
). - See Also:
getDomainAxis(int)
,setDomainAxis(ValueAxis)
-
getDomainAxis
public ValueAxis getDomainAxis(int index)
Returns the domain axis with the specified index, ornull
if there is no axis with that index.- Parameters:
index
- the axis index.- Returns:
- The axis (
null
possible). - See Also:
setDomainAxis(int, ValueAxis)
-
getDomainAxes
public java.util.Map<java.lang.Integer,ValueAxis> getDomainAxes()
Returns a map containing the domain axes that are assigned to this plot. The map is unmodifiable.- Returns:
- A map containing the domain axes that are assigned to the plot
(never
null
). - Since:
- 1.5.4
-
setDomainAxis
public void setDomainAxis(ValueAxis axis)
Sets the domain axis for the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
axis
- the new axis (null
permitted).- See Also:
getDomainAxis()
,setDomainAxis(int, ValueAxis)
-
setDomainAxis
public void setDomainAxis(int index, ValueAxis axis)
Sets a domain axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.axis
- the axis (null
permitted).- See Also:
getDomainAxis(int)
,setRangeAxis(int, ValueAxis)
-
setDomainAxis
public void setDomainAxis(int index, ValueAxis axis, boolean notify)
Sets a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.axis
- the axis.notify
- notify listeners?- See Also:
getDomainAxis(int)
-
setDomainAxes
public void setDomainAxes(ValueAxis[] axes)
Sets the domain axes for this plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
axes
- the axes (null
not permitted).- See Also:
setRangeAxes(ValueAxis[])
-
getDomainAxisLocation
public AxisLocation getDomainAxisLocation()
Returns the location of the primary domain axis.- Returns:
- The location (never
null
). - See Also:
setDomainAxisLocation(AxisLocation)
-
setDomainAxisLocation
public void setDomainAxisLocation(AxisLocation location)
Sets the location of the primary domain axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
location
- the location (null
not permitted).- See Also:
getDomainAxisLocation()
-
setDomainAxisLocation
public void setDomainAxisLocation(AxisLocation location, boolean notify)
Sets the location of the domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
location
- the location (null
not permitted).notify
- notify listeners?- See Also:
getDomainAxisLocation()
-
getDomainAxisEdge
public RectangleEdge getDomainAxisEdge()
Returns the edge for the primary domain axis (taking into account the plot's orientation).- Returns:
- The edge.
- See Also:
getDomainAxisLocation()
,getOrientation()
-
getDomainAxisCount
public int getDomainAxisCount()
Returns the number of domain axes.- Returns:
- The axis count.
- See Also:
getRangeAxisCount()
-
clearDomainAxes
public void clearDomainAxes()
Clears the domain axes from the plot and sends aPlotChangeEvent
to all registered listeners.- See Also:
clearRangeAxes()
-
configureDomainAxes
public void configureDomainAxes()
Configures the domain axes.
-
getDomainAxisLocation
public AxisLocation getDomainAxisLocation(int index)
Returns the location for a domain axis. If this hasn't been set explicitly, the method returns the location that is opposite to the primary domain axis location.- Parameters:
index
- the axis index (must be >= 0).- Returns:
- The location (never
null
). - See Also:
setDomainAxisLocation(int, AxisLocation)
-
setDomainAxisLocation
public void setDomainAxisLocation(int index, AxisLocation location)
Sets the location for a domain axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.location
- the location (null
not permitted for index 0).- See Also:
getDomainAxisLocation(int)
-
setDomainAxisLocation
public void setDomainAxisLocation(int index, AxisLocation location, boolean notify)
Sets the axis location for a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index (must be >= 0).location
- the location (null
not permitted for index 0).notify
- notify listeners?- See Also:
getDomainAxisLocation(int)
,setRangeAxisLocation(int, AxisLocation, boolean)
-
getDomainAxisEdge
public RectangleEdge getDomainAxisEdge(int index)
Returns the edge for a domain axis.- Parameters:
index
- the axis index.- Returns:
- The edge.
- See Also:
getRangeAxisEdge(int)
-
getRangeAxis
public ValueAxis getRangeAxis()
Returns the range axis for the plot. If the range axis for this plot isnull
, then the method will return the parent plot's range axis (if there is a parent plot).- Returns:
- The range axis.
- See Also:
getRangeAxis(int)
,setRangeAxis(ValueAxis)
-
setRangeAxis
public void setRangeAxis(ValueAxis axis)
Sets the range axis for the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
axis
- the axis (null
permitted).- See Also:
getRangeAxis()
,setRangeAxis(int, ValueAxis)
-
getRangeAxisLocation
public AxisLocation getRangeAxisLocation()
Returns the location of the primary range axis.- Returns:
- The location (never
null
). - See Also:
setRangeAxisLocation(AxisLocation)
-
setRangeAxisLocation
public void setRangeAxisLocation(AxisLocation location)
Sets the location of the primary range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
location
- the location (null
not permitted).- See Also:
getRangeAxisLocation()
-
setRangeAxisLocation
public void setRangeAxisLocation(AxisLocation location, boolean notify)
Sets the location of the primary range axis and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
location
- the location (null
not permitted).notify
- notify listeners?- See Also:
getRangeAxisLocation()
-
getRangeAxisEdge
public RectangleEdge getRangeAxisEdge()
Returns the edge for the primary range axis.- Returns:
- The range axis edge.
- See Also:
getRangeAxisLocation()
,getOrientation()
-
getRangeAxis
public ValueAxis getRangeAxis(int index)
Returns the range axis with the specified index, ornull
if there is no axis with that index.- Parameters:
index
- the axis index (must be >= 0).- Returns:
- The axis (
null
possible). - See Also:
setRangeAxis(int, ValueAxis)
-
getRangeAxes
public java.util.Map<java.lang.Integer,ValueAxis> getRangeAxes()
Returns a map containing the range axes that are assigned to this plot. The map is unmodifiable.- Returns:
- A map containing the range axes that are assigned to the plot
(never
null
). - Since:
- 1.5.4
-
setRangeAxis
public void setRangeAxis(int index, ValueAxis axis)
Sets a range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.axis
- the axis (null
permitted).- See Also:
getRangeAxis(int)
-
setRangeAxis
public void setRangeAxis(int index, ValueAxis axis, boolean notify)
Sets a range axis and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.axis
- the axis (null
permitted).notify
- notify listeners?- See Also:
getRangeAxis(int)
-
setRangeAxes
public void setRangeAxes(ValueAxis[] axes)
Sets the range axes for this plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
axes
- the axes (null
not permitted).- See Also:
setDomainAxes(ValueAxis[])
-
getRangeAxisCount
public int getRangeAxisCount()
Returns the number of range axes.- Returns:
- The axis count.
- See Also:
getDomainAxisCount()
-
clearRangeAxes
public void clearRangeAxes()
Clears the range axes from the plot and sends aPlotChangeEvent
to all registered listeners.- See Also:
clearDomainAxes()
-
configureRangeAxes
public void configureRangeAxes()
Configures the range axes.- See Also:
configureDomainAxes()
-
getRangeAxisLocation
public AxisLocation getRangeAxisLocation(int index)
Returns the location for a range axis. If this hasn't been set explicitly, the method returns the location that is opposite to the primary range axis location.- Parameters:
index
- the axis index (must be >= 0).- Returns:
- The location (never
null
). - See Also:
setRangeAxisLocation(int, AxisLocation)
-
setRangeAxisLocation
public void setRangeAxisLocation(int index, AxisLocation location)
Sets the location for a range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.location
- the location (null
permitted).- See Also:
getRangeAxisLocation(int)
-
setRangeAxisLocation
public void setRangeAxisLocation(int index, AxisLocation location, boolean notify)
Sets the axis location for a domain axis and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the axis index.location
- the location (null
not permitted for index 0).notify
- notify listeners?- See Also:
getRangeAxisLocation(int)
,setDomainAxisLocation(int, AxisLocation, boolean)
-
getRangeAxisEdge
public RectangleEdge getRangeAxisEdge(int index)
Returns the edge for a range axis.- Parameters:
index
- the axis index.- Returns:
- The edge.
- See Also:
getRangeAxisLocation(int)
,getOrientation()
-
getDataset
public XYDataset getDataset()
Returns the primary dataset for the plot.- Returns:
- The primary dataset (possibly
null
). - See Also:
getDataset(int)
,setDataset(XYDataset)
-
getDataset
public XYDataset getDataset(int index)
Returns the dataset with the specified index, ornull
if there is no dataset with that index.- Parameters:
index
- the dataset index (must be >= 0).- Returns:
- The dataset (possibly
null
). - See Also:
setDataset(int, XYDataset)
-
getDatasets
public java.util.Map<java.lang.Integer,XYDataset> getDatasets()
Returns a map containing the datasets that are assigned to this plot. The map is unmodifiable.- Returns:
- A map containing the datasets that are assigned to the plot
(never
null
). - Since:
- 1.5.4
-
setDataset
public void setDataset(XYDataset dataset)
Sets the primary dataset for the plot, replacing the existing dataset if there is one.- Parameters:
dataset
- the dataset (null
permitted).- See Also:
getDataset()
,setDataset(int, XYDataset)
-
setDataset
public void setDataset(int index, XYDataset dataset)
Sets a dataset for the plot and sends a change event to all registered listeners.- Parameters:
index
- the dataset index (must be >= 0).dataset
- the dataset (null
permitted).- See Also:
getDataset(int)
-
getDatasetCount
public int getDatasetCount()
Returns the number of datasets.- Returns:
- The number of datasets.
-
indexOf
public int indexOf(XYDataset 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 or -1.
-
mapDatasetToDomainAxis
public void mapDatasetToDomainAxis(int index, int axisIndex)
Maps a dataset to a particular domain axis. All data will be plotted against axis zero by default, no mapping is required for this case.- Parameters:
index
- the dataset index (zero-based).axisIndex
- the axis index.- See Also:
mapDatasetToRangeAxis(int, int)
-
mapDatasetToDomainAxes
public void mapDatasetToDomainAxes(int index, java.util.List<java.lang.Integer> 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).
-
mapDatasetToRangeAxis
public void mapDatasetToRangeAxis(int index, int axisIndex)
Maps a dataset to a particular range axis. All data will be plotted against axis zero by default, no mapping is required for this case.- Parameters:
index
- the dataset index (zero-based).axisIndex
- the axis index.- See Also:
mapDatasetToDomainAxis(int, int)
-
mapDatasetToRangeAxes
public void mapDatasetToRangeAxes(int index, java.util.List<java.lang.Integer> 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).
-
checkAxisIndices
private void checkAxisIndices(java.util.List<java.lang.Integer> indices)
This method is used to perform argument checking on the list of axis indices passed to mapDatasetToDomainAxes() and mapDatasetToRangeAxes().- Parameters:
indices
- the list of indices (null
permitted).
-
getRendererCount
public int getRendererCount()
Returns the number of renderer slots for this plot.- Returns:
- The number of renderer slots.
-
getRenderer
public XYItemRenderer getRenderer()
Returns the renderer for the primary dataset.- Returns:
- The item renderer (possibly
null
). - See Also:
setRenderer(XYItemRenderer)
-
getRenderer
public XYItemRenderer getRenderer(int index)
Returns the renderer with the specified index, ornull
.- Parameters:
index
- the renderer index (must be >= 0).- Returns:
- The renderer (possibly
null
). - See Also:
setRenderer(int, XYItemRenderer)
-
getRenderers
public java.util.Map<java.lang.Integer,XYItemRenderer> getRenderers()
Returns a map containing the renderers that are assigned to this plot. The map is unmodifiable.- Returns:
- A map containing the renderers that are assigned to the plot
(never
null
). - Since:
- 1.5.4
-
setRenderer
public void setRenderer(XYItemRenderer renderer)
Sets the renderer for the primary dataset and sends a change event to all registered listeners. If the renderer is set tonull
, no data will be displayed.- Parameters:
renderer
- the renderer (null
permitted).- See Also:
getRenderer()
-
setRenderer
public void setRenderer(int index, XYItemRenderer renderer)
Sets the renderer for the dataset with the specified index and sends a change event to all registered listeners. Note that each dataset should have its own renderer, you should not use one renderer for multiple datasets.- Parameters:
index
- the index (must be >= 0).renderer
- the renderer.- See Also:
getRenderer(int)
-
setRenderer
public void setRenderer(int index, XYItemRenderer renderer, boolean notify)
Sets the renderer for the dataset with the specified index and, if requested, sends a change event to all registered listeners. Note that each dataset should have its own renderer, you should not use one renderer for multiple datasets.- Parameters:
index
- the index (must be >= 0).renderer
- the renderer.notify
- notify listeners?- See Also:
getRenderer(int)
-
setRenderers
public void setRenderers(XYItemRenderer[] renderers)
Sets the renderers for this plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
renderers
- the renderers (null
not permitted).
-
getDatasetRenderingOrder
public DatasetRenderingOrder getDatasetRenderingOrder()
Returns the dataset rendering order.- Returns:
- The order (never
null
). - See Also:
setDatasetRenderingOrder(DatasetRenderingOrder)
-
setDatasetRenderingOrder
public void setDatasetRenderingOrder(DatasetRenderingOrder order)
Sets the rendering order and sends aPlotChangeEvent
to all registered listeners. By default, the plot renders the primary dataset last (so that the primary dataset overlays the secondary datasets). You can reverse this if you want to.- Parameters:
order
- the rendering order (null
not permitted).- See Also:
getDatasetRenderingOrder()
-
getSeriesRenderingOrder
public SeriesRenderingOrder getSeriesRenderingOrder()
Returns the series rendering order.- Returns:
- the order (never
null
). - See Also:
setSeriesRenderingOrder(SeriesRenderingOrder)
-
setSeriesRenderingOrder
public void setSeriesRenderingOrder(SeriesRenderingOrder order)
Sets the series order and sends aPlotChangeEvent
to all registered listeners. By default, the plot renders the primary series last (so that the primary series appears to be on top). You can reverse this if you want to.- Parameters:
order
- the rendering order (null
not permitted).- See Also:
getSeriesRenderingOrder()
-
getIndexOf
public int getIndexOf(XYItemRenderer 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.
-
getRendererForDataset
public XYItemRenderer getRendererForDataset(XYDataset dataset)
Returns the renderer for the specified dataset (this is either the renderer with the same index as the dataset or, if there isn't a renderer with the same index, the default renderer). If the dataset does not belong to the plot, this method will returnnull
.- Parameters:
dataset
- the dataset (null
permitted).- Returns:
- The renderer (possibly
null
).
-
getWeight
public int getWeight()
Returns the weight for this plot when it is used as a subplot within a combined plot.- Returns:
- The weight.
- See Also:
setWeight(int)
-
setWeight
public void setWeight(int weight)
Sets the weight for the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
weight
- the weight.- See Also:
getWeight()
-
isDomainGridlinesVisible
public boolean isDomainGridlinesVisible()
Returnstrue
if the domain gridlines are visible, andfalse
otherwise.- Returns:
true
orfalse
.- See Also:
setDomainGridlinesVisible(boolean)
-
setDomainGridlinesVisible
public void setDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the domain 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.- See Also:
isDomainGridlinesVisible()
-
isDomainMinorGridlinesVisible
public boolean isDomainMinorGridlinesVisible()
Returnstrue
if the domain minor gridlines are visible, andfalse
otherwise.- Returns:
true
orfalse
.- See Also:
setDomainMinorGridlinesVisible(boolean)
-
setDomainMinorGridlinesVisible
public void setDomainMinorGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the domain 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.- See Also:
isDomainMinorGridlinesVisible()
-
getDomainGridlineStroke
public java.awt.Stroke getDomainGridlineStroke()
Returns the stroke for the grid-lines (if any) plotted against the domain axis.- Returns:
- The stroke (never
null
). - See Also:
setDomainGridlineStroke(Stroke)
-
setDomainGridlineStroke
public void setDomainGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
getDomainGridlineStroke()
-
getDomainMinorGridlineStroke
public java.awt.Stroke getDomainMinorGridlineStroke()
Returns the stroke for the minor grid-lines (if any) plotted against the domain axis.- Returns:
- The stroke (never
null
). - See Also:
setDomainMinorGridlineStroke(Stroke)
-
setDomainMinorGridlineStroke
public void setDomainMinorGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the minor grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
getDomainMinorGridlineStroke()
-
getDomainGridlinePaint
public java.awt.Paint getDomainGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the domain axis.- Returns:
- The paint (never
null
). - See Also:
setDomainGridlinePaint(Paint)
-
setDomainGridlinePaint
public void setDomainGridlinePaint(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getDomainGridlinePaint()
-
getDomainMinorGridlinePaint
public java.awt.Paint getDomainMinorGridlinePaint()
Returns the paint for the minor grid lines (if any) plotted against the domain axis.- Returns:
- The paint (never
null
). - See Also:
setDomainMinorGridlinePaint(Paint)
-
setDomainMinorGridlinePaint
public void setDomainMinorGridlinePaint(java.awt.Paint paint)
Sets the paint for the minor grid lines plotted against the domain axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- Throws:
java.lang.IllegalArgumentException
- ifPaint
isnull
.- See Also:
getDomainMinorGridlinePaint()
-
isRangeGridlinesVisible
public boolean isRangeGridlinesVisible()
Returnstrue
if the range axis grid is visible, andfalse
otherwise.- Returns:
- A boolean.
- See Also:
setRangeGridlinesVisible(boolean)
-
setRangeGridlinesVisible
public void setRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the range axis 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.- See Also:
isRangeGridlinesVisible()
-
getRangeGridlineStroke
public java.awt.Stroke getRangeGridlineStroke()
Returns the stroke for the grid lines (if any) plotted against the range axis.- Returns:
- The stroke (never
null
). - See Also:
setRangeGridlineStroke(Stroke)
-
setRangeGridlineStroke
public void setRangeGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
getRangeGridlineStroke()
-
getRangeGridlinePaint
public java.awt.Paint getRangeGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the range axis.- Returns:
- The paint (never
null
). - See Also:
setRangeGridlinePaint(Paint)
-
setRangeGridlinePaint
public void setRangeGridlinePaint(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getRangeGridlinePaint()
-
isRangeMinorGridlinesVisible
public boolean isRangeMinorGridlinesVisible()
Returnstrue
if the range axis minor grid is visible, andfalse
otherwise.- Returns:
- A boolean.
- See Also:
setRangeMinorGridlinesVisible(boolean)
-
setRangeMinorGridlinesVisible
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.- See Also:
isRangeMinorGridlinesVisible()
-
getRangeMinorGridlineStroke
public java.awt.Stroke getRangeMinorGridlineStroke()
Returns the stroke for the minor grid lines (if any) plotted against the range axis.- Returns:
- The stroke (never
null
). - See Also:
setRangeMinorGridlineStroke(Stroke)
-
setRangeMinorGridlineStroke
public void setRangeMinorGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the minor grid lines plotted against the range axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
getRangeMinorGridlineStroke()
-
getRangeMinorGridlinePaint
public java.awt.Paint getRangeMinorGridlinePaint()
Returns the paint for the minor grid lines (if any) plotted against the range axis.- Returns:
- The paint (never
null
). - See Also:
setRangeMinorGridlinePaint(Paint)
-
setRangeMinorGridlinePaint
public void setRangeMinorGridlinePaint(java.awt.Paint paint)
Sets the paint for the minor grid lines plotted against the range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getRangeMinorGridlinePaint()
-
isDomainZeroBaselineVisible
public boolean isDomainZeroBaselineVisible()
Returns a flag that controls whether or not a zero baseline is displayed for the domain axis.- Returns:
- A boolean.
- See Also:
setDomainZeroBaselineVisible(boolean)
-
setDomainZeroBaselineVisible
public void setDomainZeroBaselineVisible(boolean visible)
Sets the flag that controls whether or not the zero baseline is displayed for the domain axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
visible
- the flag.- See Also:
isDomainZeroBaselineVisible()
-
getDomainZeroBaselineStroke
public java.awt.Stroke getDomainZeroBaselineStroke()
Returns the stroke used for the zero baseline against the domain axis.- Returns:
- The stroke (never
null
). - See Also:
setDomainZeroBaselineStroke(Stroke)
-
setDomainZeroBaselineStroke
public void setDomainZeroBaselineStroke(java.awt.Stroke stroke)
Sets the stroke for the zero baseline for the domain axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
getRangeZeroBaselineStroke()
-
getDomainZeroBaselinePaint
public java.awt.Paint getDomainZeroBaselinePaint()
Returns the paint for the zero baseline (if any) plotted against the domain axis.- Returns:
- The paint (never
null
). - See Also:
setDomainZeroBaselinePaint(Paint)
-
setDomainZeroBaselinePaint
public void setDomainZeroBaselinePaint(java.awt.Paint paint)
Sets the paint for the zero baseline plotted against the domain axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getDomainZeroBaselinePaint()
-
isRangeZeroBaselineVisible
public boolean isRangeZeroBaselineVisible()
Returns a flag that controls whether or not a zero baseline is displayed for the range axis.- Returns:
- A boolean.
- See Also:
setRangeZeroBaselineVisible(boolean)
-
setRangeZeroBaselineVisible
public void setRangeZeroBaselineVisible(boolean visible)
Sets the flag that controls whether or not the zero baseline is displayed for the range axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
visible
- the flag.- See Also:
isRangeZeroBaselineVisible()
-
getRangeZeroBaselineStroke
public java.awt.Stroke getRangeZeroBaselineStroke()
Returns the stroke used for the zero baseline against the range axis.- Returns:
- The stroke (never
null
). - See Also:
setRangeZeroBaselineStroke(Stroke)
-
setRangeZeroBaselineStroke
public void setRangeZeroBaselineStroke(java.awt.Stroke stroke)
Sets the stroke for the zero baseline for the range axis, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
getRangeZeroBaselineStroke()
-
getRangeZeroBaselinePaint
public java.awt.Paint getRangeZeroBaselinePaint()
Returns the paint for the zero baseline (if any) plotted against the range axis.- Returns:
- The paint (never
null
). - See Also:
setRangeZeroBaselinePaint(Paint)
-
setRangeZeroBaselinePaint
public void setRangeZeroBaselinePaint(java.awt.Paint paint)
Sets the paint for the zero baseline plotted against the range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getRangeZeroBaselinePaint()
-
getDomainTickBandPaint
public java.awt.Paint getDomainTickBandPaint()
Returns the paint used for the domain tick bands. If this isnull
, no tick bands will be drawn.- Returns:
- The paint (possibly
null
). - See Also:
setDomainTickBandPaint(Paint)
-
setDomainTickBandPaint
public void setDomainTickBandPaint(java.awt.Paint paint)
Sets the paint for the domain tick bands.- Parameters:
paint
- the paint (null
permitted).- See Also:
getDomainTickBandPaint()
-
getRangeTickBandPaint
public java.awt.Paint getRangeTickBandPaint()
Returns the paint used for the range tick bands. If this isnull
, no tick bands will be drawn.- Returns:
- The paint (possibly
null
). - See Also:
setRangeTickBandPaint(Paint)
-
setRangeTickBandPaint
public void setRangeTickBandPaint(java.awt.Paint paint)
Sets the paint for the range tick bands.- Parameters:
paint
- the paint (null
permitted).- See Also:
getRangeTickBandPaint()
-
getQuadrantOrigin
public java.awt.geom.Point2D getQuadrantOrigin()
Returns the origin for the quadrants that can be displayed on the plot. This defaults to (0, 0).- Returns:
- The origin point (never
null
). - See Also:
setQuadrantOrigin(Point2D)
-
setQuadrantOrigin
public void setQuadrantOrigin(java.awt.geom.Point2D origin)
Sets the quadrant origin and sends aPlotChangeEvent
to all registered listeners.- Parameters:
origin
- the origin (null
not permitted).- See Also:
getQuadrantOrigin()
-
getQuadrantPaint
public java.awt.Paint getQuadrantPaint(int index)
Returns the paint used for the specified quadrant.- Parameters:
index
- the quadrant index (0-3).- Returns:
- The paint (possibly
null
). - See Also:
setQuadrantPaint(int, Paint)
-
setQuadrantPaint
public void setQuadrantPaint(int index, java.awt.Paint paint)
Sets the paint used for the specified quadrant and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the quadrant index (0-3).paint
- the paint (null
permitted).- See Also:
getQuadrantPaint(int)
-
addDomainMarker
public void addDomainMarker(Marker marker)
Adds a marker for the domain axis and sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis, however this is entirely up to the renderer.
- Parameters:
marker
- the marker (null
not permitted).- See Also:
addDomainMarker(Marker, Layer)
,clearDomainMarkers()
-
addDomainMarker
public void addDomainMarker(Marker marker, Layer layer)
Adds a marker for the domain axis in the specified layer and sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis, however this is entirely up to the renderer.
- Parameters:
marker
- the marker (null
not permitted).layer
- the layer (foreground or background).- See Also:
addDomainMarker(int, Marker, Layer)
-
clearDomainMarkers
public void clearDomainMarkers()
Clears all the (foreground and background) domain markers and sends aPlotChangeEvent
to all registered listeners.- See Also:
addDomainMarker(int, Marker, Layer)
-
clearDomainMarkers
public void clearDomainMarkers(int index)
Clears the (foreground and background) domain markers for a particular renderer and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the renderer index.- See Also:
clearRangeMarkers(int)
-
addDomainMarker
public void addDomainMarker(int index, Marker marker, Layer layer)
Adds a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis (that the renderer is mapped to), however this is entirely up to the renderer.
- Parameters:
index
- the dataset/renderer index.marker
- the marker.layer
- the layer (foreground or background).- See Also:
clearDomainMarkers(int)
,addRangeMarker(int, Marker, Layer)
-
addDomainMarker
public void addDomainMarker(int index, Marker marker, Layer layer, boolean notify)
Adds a marker for a specific dataset/renderer and, if requested, sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the domain axis (that the renderer is mapped to), however this is entirely up to the renderer.
- Parameters:
index
- the dataset/renderer index.marker
- the marker.layer
- the layer (foreground or background).notify
- notify listeners?
-
removeDomainMarker
public boolean removeDomainMarker(Marker marker)
Removes a marker for the domain axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
marker
- the marker.- Returns:
- A boolean indicating whether or not the marker was actually removed.
-
removeDomainMarker
public boolean removeDomainMarker(Marker marker, Layer layer)
Removes a marker for the domain axis in the specified layer and sends aPlotChangeEvent
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.
-
removeDomainMarker
public boolean removeDomainMarker(int index, Marker marker, Layer layer)
Removes a marker for a specific dataset/renderer and sends aPlotChangeEvent
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.
-
removeDomainMarker
public boolean removeDomainMarker(int index, Marker marker, Layer layer, boolean notify)
Removes a marker for a specific dataset/renderer and, if requested, sends aPlotChangeEvent
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.
-
addRangeMarker
public void addRangeMarker(Marker marker)
Adds a marker for the range axis and sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.
- Parameters:
marker
- the marker (null
not permitted).- See Also:
addRangeMarker(Marker, Layer)
-
addRangeMarker
public void addRangeMarker(Marker marker, Layer layer)
Adds a marker for the range axis in the specified layer and sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.
- Parameters:
marker
- the marker (null
not permitted).layer
- the layer (foreground or background).- See Also:
addRangeMarker(int, Marker, Layer)
-
clearRangeMarkers
public void clearRangeMarkers()
Clears all the range markers and sends aPlotChangeEvent
to all registered listeners.- See Also:
clearRangeMarkers()
-
addRangeMarker
public void addRangeMarker(int index, Marker marker, Layer layer)
Adds a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.
- Parameters:
index
- the dataset/renderer index.marker
- the marker.layer
- the layer (foreground or background).- See Also:
clearRangeMarkers(int)
,addDomainMarker(int, Marker, Layer)
-
addRangeMarker
public void addRangeMarker(int index, Marker marker, Layer layer, boolean notify)
Adds a marker for a specific dataset/renderer and, if requested, sends aPlotChangeEvent
to all registered listeners.Typically a marker will be drawn by the renderer as a line perpendicular to the range axis, however this is entirely up to the renderer.
- Parameters:
index
- the dataset/renderer index.marker
- the marker.layer
- the layer (foreground or background).notify
- notify listeners?
-
clearRangeMarkers
public void clearRangeMarkers(int index)
Clears the (foreground and background) range markers for a particular renderer.- Parameters:
index
- the renderer index.
-
removeRangeMarker
public boolean removeRangeMarker(Marker marker)
Removes a marker for the range axis and sends aPlotChangeEvent
to all registered listeners.- Parameters:
marker
- the marker.- Returns:
- A boolean indicating whether or not the marker was actually removed.
-
removeRangeMarker
public boolean removeRangeMarker(Marker marker, Layer layer)
Removes a marker for the range axis in the specified layer and sends aPlotChangeEvent
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.
-
removeRangeMarker
public boolean removeRangeMarker(int index, Marker marker, Layer layer)
Removes a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the dataset/renderer index.marker
- the marker (null
not permitted).layer
- the layer (foreground or background).- Returns:
- A boolean indicating whether or not the marker was actually removed.
-
removeRangeMarker
public boolean removeRangeMarker(int index, Marker marker, Layer layer, boolean notify)
Removes a marker for a specific dataset/renderer and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the dataset/renderer index.marker
- the marker (null
not permitted).layer
- the layer (foreground or background) (null
not permitted).notify
- notify listeners?- Returns:
- A boolean indicating whether or not the marker was actually removed.
-
addAnnotation
public void addAnnotation(XYAnnotation annotation)
Adds an annotation to the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
annotation
- the annotation (null
not permitted).- See Also:
getAnnotations()
,removeAnnotation(XYAnnotation)
-
addAnnotation
public void addAnnotation(XYAnnotation annotation, boolean notify)
Adds an annotation to the plot and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
annotation
- the annotation (null
not permitted).notify
- notify listeners?
-
removeAnnotation
public boolean removeAnnotation(XYAnnotation annotation)
Removes an annotation from the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
annotation
- the annotation (null
not permitted).- Returns:
- A boolean (indicates whether or not the annotation was removed).
- See Also:
addAnnotation(XYAnnotation)
,getAnnotations()
-
removeAnnotation
public boolean removeAnnotation(XYAnnotation annotation, boolean notify)
Removes an annotation from the plot and sends aPlotChangeEvent
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).
-
getAnnotations
public java.util.List<XYAnnotation> getAnnotations()
Returns the list of annotations.- Returns:
- The list of annotations.
- See Also:
addAnnotation(XYAnnotation)
-
clearAnnotations
public void clearAnnotations()
Clears all the annotations and sends aPlotChangeEvent
to all registered listeners.- See Also:
addAnnotation(XYAnnotation)
-
getShadowGenerator
public ShadowGenerator getShadowGenerator()
Returns the shadow generator for the plot, if any.- Returns:
- The shadow generator (possibly
null
).
-
setShadowGenerator
public void setShadowGenerator(ShadowGenerator generator)
Sets the shadow generator for the plot and sends aPlotChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).
-
calculateAxisSpace
protected AxisSpace calculateAxisSpace(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea)
Calculates the space required for all the axes in the plot.- Parameters:
g2
- the graphics device.plotArea
- the plot area.- Returns:
- The required space.
-
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.
-
integerise
private java.awt.Rectangle integerise(java.awt.geom.Rectangle2D rect)
Trims a rectangle to integer coordinates.- Parameters:
rect
- the incoming rectangle.- Returns:
- A rectangle with integer coordinates.
-
draw
public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the plot within the specified area on a graphics device.- Specified by:
draw
in classPlot
- Parameters:
g2
- the graphics device.area
- the plot area (in Java2D space).anchor
- an anchor point in Java2D space (null
permitted).parentState
- the state from the parent plot, if there is one (null
permitted).info
- collects chart drawing information (null
permitted).
-
getDatasetIndices
private java.util.List<java.lang.Integer> getDatasetIndices(DatasetRenderingOrder order)
Returns the indices of the non-null datasets in the specified order.- Parameters:
order
- the order (null
not permitted).- Returns:
- The list of indices.
-
getRendererIndices
private java.util.List<java.lang.Integer> getRendererIndices(DatasetRenderingOrder order)
-
drawBackground
public void drawBackground(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws the background for the plot.- Overrides:
drawBackground
in classPlot
- Parameters:
g2
- the graphics device.area
- the area.
-
drawQuadrants
protected void drawQuadrants(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws the quadrants.- Parameters:
g2
- the graphics device.area
- the area.- See Also:
setQuadrantOrigin(Point2D)
,setQuadrantPaint(int, Paint)
-
drawDomainTickBands
public void drawDomainTickBands(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List<ValueTick> ticks)
Draws the domain tick bands, if any.- Parameters:
g2
- the graphics device.dataArea
- the data area.ticks
- the ticks.- See Also:
setDomainTickBandPaint(Paint)
-
drawRangeTickBands
public void drawRangeTickBands(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List<ValueTick> ticks)
Draws the range tick bands, if any.- Parameters:
g2
- the graphics device.dataArea
- the data area.ticks
- the ticks.- See Also:
setRangeTickBandPaint(Paint)
-
drawAxes
protected java.util.Map<Axis,AxisState> drawAxes(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo plotState)
A utility method for drawing the axes.- Parameters:
g2
- the graphics device (null
not permitted).plotArea
- the plot area (null
not permitted).dataArea
- the data area (null
not permitted).plotState
- collects information about the plot (null
permitted).- Returns:
- A map containing the state for each axis drawn.
-
render
public boolean render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, int index, PlotRenderingInfo info, CrosshairState crosshairState)
Draws a representation of the data within the dataArea region, using the current renderer.The
info
andcrosshairState
arguments may benull
.- Parameters:
g2
- the graphics device.dataArea
- the region in which the data is to be drawn.index
- the dataset index.info
- an optional object for collection dimension information.crosshairState
- collects crosshair information (null
permitted).- Returns:
- A flag that indicates whether any data was actually rendered.
-
getDomainAxisForDataset
public ValueAxis getDomainAxisForDataset(int index)
Returns the domain axis for a dataset.- Parameters:
index
- the dataset index (must be >= 0).- Returns:
- The axis.
-
getRangeAxisForDataset
public ValueAxis getRangeAxisForDataset(int index)
Returns the range axis for a dataset.- Parameters:
index
- the dataset index (must be >= 0).- Returns:
- The axis.
-
drawDomainGridlines
protected void drawDomainGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List<ValueTick> ticks)
Draws the gridlines for the plot, if they are visible.- Parameters:
g2
- the graphics device.dataArea
- the data area.ticks
- the ticks.- See Also:
drawRangeGridlines(Graphics2D, Rectangle2D, List)
-
drawRangeGridlines
protected void drawRangeGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.util.List<ValueTick> ticks)
Draws the gridlines for the plot's primary range axis, if they are visible.- Parameters:
g2
- the graphics device.area
- the data area.ticks
- the ticks.- See Also:
drawDomainGridlines(Graphics2D, Rectangle2D, List)
-
drawZeroDomainBaseline
protected void drawZeroDomainBaseline(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws a base line across the chart at value zero on the domain axis.- Parameters:
g2
- the graphics device.area
- the data area.- See Also:
setDomainZeroBaselineVisible(boolean)
-
drawZeroRangeBaseline
protected void drawZeroRangeBaseline(java.awt.Graphics2D g2, java.awt.geom.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.- See Also:
setRangeZeroBaselineVisible(boolean)
-
drawAnnotations
public void drawAnnotations(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info)
Draws the annotations for the plot.- Parameters:
g2
- the graphics device.dataArea
- the data area.info
- the chart rendering info.
-
drawDomainMarkers
protected void drawDomainMarkers(java.awt.Graphics2D g2, java.awt.geom.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 dataset/renderer index.layer
- the layer (foreground or background).
-
drawRangeMarkers
protected void drawRangeMarkers(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, int index, Layer layer)
Draws the range markers (if any) for a renderer 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).
-
getDomainMarkers
public java.util.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.
- See Also:
getRangeMarkers(Layer)
-
getRangeMarkers
public java.util.Collection<Marker> getRangeMarkers(Layer layer)
Returns the list of range markers (read only) for the specified layer.- Parameters:
layer
- the layer (foreground or background).- Returns:
- The list of range markers.
- See Also:
getDomainMarkers(Layer)
-
getDomainMarkers
public java.util.Collection<Marker> 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
). - See Also:
getRangeMarkers(int, Layer)
-
getRangeMarkers
public java.util.Collection<Marker> 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
). - See Also:
getDomainMarkers(int, Layer)
-
drawHorizontalLine
protected void drawHorizontalLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Stroke stroke, java.awt.Paint paint)
Utility method for drawing a horizontal line across the data area of the plot.- Parameters:
g2
- the graphics device.dataArea
- the data area.value
- the coordinate, where to draw the line.stroke
- the stroke to use.paint
- the paint to use.
-
drawDomainCrosshair
protected void drawDomainCrosshair(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotOrientation orientation, double value, ValueAxis axis, java.awt.Stroke stroke, java.awt.Paint paint)
Draws a domain 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.
-
drawVerticalLine
protected void drawVerticalLine(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, double value, java.awt.Stroke stroke, java.awt.Paint paint)
Utility method for drawing a vertical line on the data area of the plot.- Parameters:
g2
- the graphics device.dataArea
- the data area.value
- the coordinate, where to draw the line.stroke
- the stroke to use.paint
- the paint to use.
-
drawRangeCrosshair
protected void drawRangeCrosshair(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotOrientation orientation, double value, ValueAxis axis, java.awt.Stroke stroke, java.awt.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.
-
handleClick
public void handleClick(int x, int y, PlotRenderingInfo info)
Handles a 'click' on the plot by updating the anchor values.- Overrides:
handleClick
in classPlot
- Parameters:
x
- the x-coordinate, where the click occurred, in Java2D space.y
- the y-coordinate, where the click occurred, in Java2D space.info
- object containing information about the plot dimensions.
-
getDatasetsMappedToDomainAxis
private java.util.List<XYDataset> getDatasetsMappedToDomainAxis(java.lang.Integer axisIndex)
A utility method that returns a list of datasets that are mapped to a particular axis.- Parameters:
axisIndex
- the axis index (null
not permitted).- Returns:
- A list of datasets.
-
getDatasetsMappedToRangeAxis
private java.util.List<XYDataset> getDatasetsMappedToRangeAxis(java.lang.Integer axisIndex)
A utility method that returns a list of datasets that are mapped to a particular axis.- Parameters:
axisIndex
- the axis index (null
not permitted).- Returns:
- A list of datasets.
-
getDomainAxisIndex
public int getDomainAxisIndex(ValueAxis axis)
Returns the index of the given domain axis.- Parameters:
axis
- the axis.- Returns:
- The axis index.
- See Also:
getRangeAxisIndex(ValueAxis)
-
findDomainAxisIndex
private int findDomainAxisIndex(ValueAxis axis)
-
getRangeAxisIndex
public int getRangeAxisIndex(ValueAxis axis)
Returns the index of the given range axis.- Parameters:
axis
- the axis.- Returns:
- The axis index.
- See Also:
getDomainAxisIndex(ValueAxis)
-
findRangeAxisIndex
private int findRangeAxisIndex(ValueAxis axis)
-
getDataRange
public Range getDataRange(ValueAxis axis)
Returns the range for the specified axis.- Specified by:
getDataRange
in interfaceValueAxisPlot
- Parameters:
axis
- the axis.- Returns:
- The range.
-
annotationChanged
public void annotationChanged(AnnotationChangeEvent event)
Receives notification of a change to anAnnotation
added to this plot.- Specified by:
annotationChanged
in interfaceAnnotationChangeListener
- Overrides:
annotationChanged
in classPlot
- Parameters:
event
- information about the event (not used here).
-
datasetChanged
public void datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset.The axis ranges are updated if necessary.
- Specified by:
datasetChanged
in interfaceDatasetChangeListener
- Overrides:
datasetChanged
in classPlot
- 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 interfaceRendererChangeListener
- Parameters:
event
- the event.
-
isDomainCrosshairVisible
public boolean isDomainCrosshairVisible()
Returns a flag indicating whether or not the domain crosshair is visible.- Returns:
- The flag.
- See Also:
setDomainCrosshairVisible(boolean)
-
setDomainCrosshairVisible
public void setDomainCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the domain crosshair is visible and, if the flag changes, sends aPlotChangeEvent
to all registered listeners.- Parameters:
flag
- the new value of the flag.- See Also:
isDomainCrosshairVisible()
-
isDomainCrosshairLockedOnData
public boolean isDomainCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.- Returns:
- The flag.
- See Also:
setDomainCrosshairLockedOnData(boolean)
-
setDomainCrosshairLockedOnData
public void setDomainCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the domain crosshair should "lock-on" to actual data values. If the flag value changes, this method sends aPlotChangeEvent
to all registered listeners.- Parameters:
flag
- the flag.- See Also:
isDomainCrosshairLockedOnData()
-
getDomainCrosshairValue
public double getDomainCrosshairValue()
Returns the domain crosshair value.- Returns:
- The value.
- See Also:
setDomainCrosshairValue(double)
-
setDomainCrosshairValue
public void setDomainCrosshairValue(double value)
Sets the domain crosshair value and sends aPlotChangeEvent
to all registered listeners (provided that the domain crosshair is visible).- Parameters:
value
- the value.- See Also:
getDomainCrosshairValue()
-
setDomainCrosshairValue
public void setDomainCrosshairValue(double value, boolean notify)
Sets the domain crosshair value and, if requested, sends aPlotChangeEvent
to all registered listeners (provided that the domain crosshair is visible).- Parameters:
value
- the new value.notify
- notify listeners?- See Also:
getDomainCrosshairValue()
-
getDomainCrosshairStroke
public java.awt.Stroke getDomainCrosshairStroke()
Returns theStroke
used to draw the crosshair (if visible).- Returns:
- The crosshair stroke (never
null
). - See Also:
setDomainCrosshairStroke(Stroke)
,isDomainCrosshairVisible()
,getDomainCrosshairPaint()
-
setDomainCrosshairStroke
public void setDomainCrosshairStroke(java.awt.Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.- Parameters:
stroke
- the new crosshair stroke (null
not permitted).- See Also:
getDomainCrosshairStroke()
-
getDomainCrosshairPaint
public java.awt.Paint getDomainCrosshairPaint()
Returns the domain crosshair paint.- Returns:
- The crosshair paint (never
null
). - See Also:
setDomainCrosshairPaint(Paint)
,isDomainCrosshairVisible()
,getDomainCrosshairStroke()
-
setDomainCrosshairPaint
public void setDomainCrosshairPaint(java.awt.Paint paint)
Sets the paint used to draw the crosshairs (if visible) and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the new crosshair paint (null
not permitted).- See Also:
getDomainCrosshairPaint()
-
isRangeCrosshairVisible
public boolean isRangeCrosshairVisible()
Returns a flag indicating whether or not the range crosshair is visible.- Returns:
- The flag.
- See Also:
setRangeCrosshairVisible(boolean)
,isDomainCrosshairVisible()
-
setRangeCrosshairVisible
public void setRangeCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the range crosshair is visible. If the flag value changes, this method sends aPlotChangeEvent
to all registered listeners.- Parameters:
flag
- the new value of the flag.- See Also:
isRangeCrosshairVisible()
-
isRangeCrosshairLockedOnData
public boolean isRangeCrosshairLockedOnData()
Returns a flag indicating whether or not the crosshair should "lock-on" to actual data values.- Returns:
- The flag.
- See Also:
setRangeCrosshairLockedOnData(boolean)
-
setRangeCrosshairLockedOnData
public void setRangeCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the range crosshair should "lock-on" to actual data values. If the flag value changes, this method sends aPlotChangeEvent
to all registered listeners.- Parameters:
flag
- the flag.- See Also:
isRangeCrosshairLockedOnData()
-
getRangeCrosshairValue
public double getRangeCrosshairValue()
Returns the range crosshair value.- Returns:
- The value.
- See Also:
setRangeCrosshairValue(double)
-
setRangeCrosshairValue
public void setRangeCrosshairValue(double value)
Sets the range crosshair value.Registered listeners are notified that the plot has been modified, but only if the crosshair is visible.
- Parameters:
value
- the new value.- See Also:
getRangeCrosshairValue()
-
setRangeCrosshairValue
public void setRangeCrosshairValue(double value, boolean notify)
Sets the range crosshair value and sends aPlotChangeEvent
to all registered listeners, but only if the crosshair is visible.- Parameters:
value
- the new value.notify
- a flag that controls whether or not listeners are notified.- See Also:
getRangeCrosshairValue()
-
getRangeCrosshairStroke
public java.awt.Stroke getRangeCrosshairStroke()
Returns the stroke used to draw the crosshair (if visible).- Returns:
- The crosshair stroke (never
null
). - See Also:
setRangeCrosshairStroke(Stroke)
,isRangeCrosshairVisible()
,getRangeCrosshairPaint()
-
setRangeCrosshairStroke
public void setRangeCrosshairStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the crosshairs (if visible) and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the new crosshair stroke (null
not permitted).- See Also:
getRangeCrosshairStroke()
-
getRangeCrosshairPaint
public java.awt.Paint getRangeCrosshairPaint()
Returns the range crosshair paint.- Returns:
- The crosshair paint (never
null
). - See Also:
setRangeCrosshairPaint(Paint)
,isRangeCrosshairVisible()
,getRangeCrosshairStroke()
-
setRangeCrosshairPaint
public void setRangeCrosshairPaint(java.awt.Paint paint)
Sets the paint used to color the crosshairs (if visible) and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the new crosshair paint (null
not permitted).- See Also:
getRangeCrosshairPaint()
-
getFixedDomainAxisSpace
public AxisSpace getFixedDomainAxisSpace()
Returns the fixed domain axis space.- Returns:
- The fixed domain axis space (possibly
null
). - See Also:
setFixedDomainAxisSpace(AxisSpace)
-
setFixedDomainAxisSpace
public void setFixedDomainAxisSpace(AxisSpace space)
Sets the fixed domain axis space and sends aPlotChangeEvent
to all registered listeners.- Parameters:
space
- the space (null
permitted).- See Also:
getFixedDomainAxisSpace()
-
setFixedDomainAxisSpace
public void setFixedDomainAxisSpace(AxisSpace space, boolean notify)
Sets the fixed domain axis space and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
space
- the space (null
permitted).notify
- notify listeners?- See Also:
getFixedDomainAxisSpace()
-
getFixedRangeAxisSpace
public AxisSpace getFixedRangeAxisSpace()
Returns the fixed range axis space.- Returns:
- The fixed range axis space (possibly
null
). - See Also:
setFixedRangeAxisSpace(AxisSpace)
-
setFixedRangeAxisSpace
public void setFixedRangeAxisSpace(AxisSpace space)
Sets the fixed range axis space and sends aPlotChangeEvent
to all registered listeners.- Parameters:
space
- the space (null
permitted).- See Also:
getFixedRangeAxisSpace()
-
setFixedRangeAxisSpace
public void setFixedRangeAxisSpace(AxisSpace space, boolean notify)
Sets the fixed range axis space and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
space
- the space (null
permitted).notify
- notify listeners?- See Also:
getFixedRangeAxisSpace()
-
isDomainPannable
public boolean isDomainPannable()
Returnstrue
if panning is enabled for the domain axes, andfalse
otherwise.- Specified by:
isDomainPannable
in interfacePannable
- Returns:
- A boolean.
-
setDomainPannable
public void setDomainPannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along the domain axes.- Parameters:
pannable
- the new flag value.
-
isRangePannable
public boolean isRangePannable()
Returnstrue
if panning is enabled for the range axis/axes, andfalse
otherwise. The default value isfalse
.- Specified by:
isRangePannable
in interfacePannable
- Returns:
- A boolean.
-
setRangePannable
public void setRangePannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along the range axis/axes.- Parameters:
pannable
- the new flag value.
-
panDomainAxes
public void panDomainAxes(double percent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Pans the domain axes by the specified percentage.- Specified by:
panDomainAxes
in interfacePannable
- Parameters:
percent
- the distance to pan (as a percentage of the axis length).info
- the plot infosource
- the source point where the pan action started.
-
panRangeAxes
public void panRangeAxes(double percent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Pans the range axes by the specified percentage.- Specified by:
panRangeAxes
in interfacePannable
- Parameters:
percent
- the distance to pan (as a percentage of the axis length).info
- the plot infosource
- the source point where the pan action started.
-
zoomDomainAxes
public void zoomDomainAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source)
Multiplies the range on the domain axis/axes by the specified factor.- Specified by:
zoomDomainAxes
in interfaceZoomable
- Parameters:
factor
- the zoom factor.info
- the plot rendering info.source
- the source point (in Java2D space).- See Also:
zoomRangeAxes(double, PlotRenderingInfo, Point2D)
-
zoomDomainAxes
public void zoomDomainAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source, boolean useAnchor)
Multiplies the range on the domain axis/axes by the specified factor.- Specified by:
zoomDomainAxes
in interfaceZoomable
- Parameters:
factor
- the zoom factor.info
- the plot rendering info.source
- the source point (in Java2D space).useAnchor
- use source point as zoom anchor?- See Also:
zoomRangeAxes(double, PlotRenderingInfo, Point2D, boolean)
-
zoomDomainAxes
public void zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Zooms in on the domain axis/axes. The new lower and upper bounds are specified as percentages of the current axis range, where 0 percent is the current lower bound and 100 percent is the current upper bound.- Specified by:
zoomDomainAxes
in interfaceZoomable
- Parameters:
lowerPercent
- a percentage that determines the new lower bound for the axis (e.g. 0.20 is twenty percent).upperPercent
- a percentage that determines the new upper bound for the axis (e.g. 0.80 is eighty percent).info
- the plot rendering info.source
- the source point (ignored).- See Also:
zoomRangeAxes(double, double, PlotRenderingInfo, Point2D)
-
zoomRangeAxes
public void zoomRangeAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source)
Multiplies the range on the range axis/axes by the specified factor.- Specified by:
zoomRangeAxes
in interfaceZoomable
- Parameters:
factor
- the zoom factor.info
- the plot rendering info.source
- the source point.- See Also:
zoomDomainAxes(double, PlotRenderingInfo, Point2D, boolean)
-
zoomRangeAxes
public void zoomRangeAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source, boolean useAnchor)
Multiplies the range on the range axis/axes by the specified factor.- Specified by:
zoomRangeAxes
in interfaceZoomable
- 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.- See Also:
zoomDomainAxes(double, PlotRenderingInfo, Point2D, boolean)
-
zoomRangeAxes
public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, java.awt.geom.Point2D source)
Zooms in on the range axes.- Specified by:
zoomRangeAxes
in interfaceZoomable
- Parameters:
lowerPercent
- the lower bound.upperPercent
- the upper bound.info
- the plot rendering info.source
- the source point.- See Also:
zoomDomainAxes(double, double, PlotRenderingInfo, Point2D)
-
isDomainZoomable
public boolean isDomainZoomable()
Returnstrue
, indicating that the domain axis/axes for this plot are zoomable.- Specified by:
isDomainZoomable
in interfaceZoomable
- Returns:
- A boolean.
- See Also:
isRangeZoomable()
-
isRangeZoomable
public boolean isRangeZoomable()
Returnstrue
, indicating that the range axis/axes for this plot are zoomable.- Specified by:
isRangeZoomable
in interfaceZoomable
- Returns:
- A boolean.
- See Also:
isDomainZoomable()
-
getSeriesCount
public int getSeriesCount()
Returns the number of series in the primary dataset for this plot. If the dataset isnull
, the method returns 0.- Returns:
- The series count.
-
getFixedLegendItems
public LegendItemCollection getFixedLegendItems()
Returns the fixed legend items, if any.- Returns:
- The legend items (possibly
null
). - See Also:
setFixedLegendItems(LegendItemCollection)
-
setFixedLegendItems
public void setFixedLegendItems(LegendItemCollection items)
Sets the fixed legend items for the plot. Leave this set tonull
if you prefer the legend items to be created automatically.- Parameters:
items
- the legend items (null
permitted).- See Also:
getFixedLegendItems()
-
getLegendItems
public LegendItemCollection getLegendItems()
Returns the legend items for the plot. Each legend item is generated by the plot's renderer, since the renderer is responsible for the visual representation of the data.- Specified by:
getLegendItems
in interfaceLegendItemSource
- Overrides:
getLegendItems
in classPlot
- Returns:
- The legend items.
-
equals
public boolean equals(java.lang.Object obj)
Tests this plot for equality with another object.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of the plot.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classPlot
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- this can occur if some component of the plot cannot be cloned.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
-