org.jfree.chart.plot

Class FastScatterPlot

public class FastScatterPlot extends Plot implements ValueAxisPlot, Zoomable, Cloneable, Serializable

A fast scatter plot.
Field Summary
static PaintDEFAULT_GRIDLINE_PAINT
The default grid line paint.
static StrokeDEFAULT_GRIDLINE_STROKE
The default grid line stroke.
protected static ResourceBundlelocalizationResources
The resourceBundle for the localization.
Constructor Summary
FastScatterPlot()
Creates a new instance of FastScatterPlot with default axes.
FastScatterPlot(float[][] data, ValueAxis domainAxis, ValueAxis rangeAxis)
Creates a new fast scatter plot.
Method Summary
Objectclone()
Returns a clone of the plot.
voiddraw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the fast scatter plot on a Java 2D graphics device (such as the screen or a printer).
protected voiddrawDomainGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot, if they are visible.
protected voiddrawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot, if they are visible.
booleanequals(Object obj)
Tests an object for equality with this instance.
float[][]getData()
Returns the data array used by the plot.
RangegetDataRange(ValueAxis axis)
Returns the range of data values to be plotted along the axis, or null if the specified axis isn't the domain axis or the range axis for the plot.
ValueAxisgetDomainAxis()
Returns the domain axis for the plot.
PaintgetDomainGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the domain axis.
StrokegetDomainGridlineStroke()
Returns the stroke for the grid-lines (if any) plotted against the domain axis.
PlotOrientationgetOrientation()
Returns the orientation of the plot.
PaintgetPaint()
Returns the paint used to plot data points.
StringgetPlotType()
Returns a short string describing the plot type.
ValueAxisgetRangeAxis()
Returns the range axis for the plot.
PaintgetRangeGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the range axis.
StrokegetRangeGridlineStroke()
Returns the stroke for the grid lines (if any) plotted against the range axis.
booleanisDomainGridlinesVisible()
Returns true if the domain gridlines are visible, and false otherwise.
booleanisDomainZoomable()
Returns true.
booleanisRangeGridlinesVisible()
Returns true if the range axis grid is visible, and false otherwise.
booleanisRangeZoomable()
Returns true.
voidrender(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState)
Draws a representation of the data within the dataArea region.
voidsetData(float[][] data)
Sets the data array used by the plot and sends a PlotChangeEvent to all registered listeners.
voidsetDomainAxis(ValueAxis axis)
Sets the domain axis and sends a PlotChangeEvent to all registered listeners.
voidsetDomainGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the domain axis and sends a PlotChangeEvent to all registered listeners.
voidsetDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the domain grid-lines are visible.
voidsetDomainGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis and sends a PlotChangeEvent to all registered listeners.
voidsetPaint(Paint paint)
Sets the color for the data points and sends a PlotChangeEvent to all registered listeners.
voidsetRangeAxis(ValueAxis axis)
Sets the range axis and sends a PlotChangeEvent to all registered listeners.
voidsetRangeGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.
voidsetRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the range axis grid lines are visible.
voidsetRangeGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.
voidzoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the domain axis by the specified factor.
voidzoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the domain axis by the specified factor.
voidzoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the domain axes.
voidzoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the range axis/axes by the specified factor.
voidzoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the range axis by the specified factor.
voidzoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the range axes.

Field Detail

DEFAULT_GRIDLINE_PAINT

public static final Paint DEFAULT_GRIDLINE_PAINT
The default grid line paint.

DEFAULT_GRIDLINE_STROKE

public static final Stroke DEFAULT_GRIDLINE_STROKE
The default grid line stroke.

localizationResources

protected static ResourceBundle localizationResources
The resourceBundle for the localization.

Constructor Detail

FastScatterPlot

public FastScatterPlot()
Creates a new instance of FastScatterPlot with default axes.

FastScatterPlot

public FastScatterPlot(float[][] data, ValueAxis domainAxis, ValueAxis rangeAxis)
Creates a new fast scatter plot.

The data is an array of x, y values: data[0][i] = x, data[1][i] = y.

Parameters: data the data (null permitted). domainAxis the domain (x) axis (null not permitted). rangeAxis the range (y) axis (null not permitted).

Method Detail

clone

public Object clone()
Returns a clone of the plot.

Returns: A clone.

Throws: CloneNotSupportedException if some component of the plot does not support cloning.

draw

public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the fast scatter plot on a Java 2D graphics device (such as the screen or a printer).

Parameters: g2 the graphics device. area the area within which the plot (including axis labels) should be drawn. anchor the anchor point (null permitted). parentState the state from the parent plot (ignored). info collects chart drawing information (null permitted).

drawDomainGridlines

protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot, if they are visible.

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

drawRangeGridlines

protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot, if they are visible.

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

equals

public boolean equals(Object obj)
Tests an object for equality with this instance.

Parameters: obj the object (null permitted).

Returns: A boolean.

getData

public float[][] getData()
Returns the data array used by the plot.

Returns: The data array (possibly null).

See Also: (float[][])

getDataRange

public Range getDataRange(ValueAxis axis)
Returns the range of data values to be plotted along the axis, or null if the specified axis isn't the domain axis or the range axis for the plot.

Parameters: axis the axis (null permitted).

Returns: The range (possibly null).

getDomainAxis

public ValueAxis getDomainAxis()
Returns the domain axis for the plot.

Returns: The domain axis (never null).

See Also: setDomainAxis

getDomainGridlinePaint

public Paint getDomainGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the domain axis.

Returns: The paint (never null).

See Also: setDomainGridlinePaint

getDomainGridlineStroke

public Stroke getDomainGridlineStroke()
Returns the stroke for the grid-lines (if any) plotted against the domain axis.

Returns: The stroke (never null).

See Also: setDomainGridlineStroke

getOrientation

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

Returns: The orientation (always VERTICAL).

getPaint

public Paint getPaint()
Returns the paint used to plot data points. The default is Color.red.

Returns: The paint.

See Also: setPaint

getPlotType

public String getPlotType()
Returns a short string describing the plot type.

Returns: A short string describing the plot type.

getRangeAxis

public ValueAxis getRangeAxis()
Returns the range axis for the plot.

Returns: The range axis (never null).

See Also: setRangeAxis

getRangeGridlinePaint

public Paint getRangeGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the range axis.

Returns: The paint (never null).

See Also: setRangeGridlinePaint

getRangeGridlineStroke

public Stroke getRangeGridlineStroke()
Returns the stroke for the grid lines (if any) plotted against the range axis.

Returns: The stroke (never null).

See Also: setRangeGridlineStroke

isDomainGridlinesVisible

public boolean isDomainGridlinesVisible()
Returns true if the domain gridlines are visible, and false otherwise.

Returns: true or false.

See Also: FastScatterPlot setDomainGridlinePaint

isDomainZoomable

public boolean isDomainZoomable()
Returns true.

Returns: A boolean.

isRangeGridlinesVisible

public boolean isRangeGridlinesVisible()
Returns true if the range axis grid is visible, and false otherwise.

Returns: true or false.

See Also: FastScatterPlot

isRangeZoomable

public boolean isRangeZoomable()
Returns true.

Returns: A boolean.

render

public void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState)
Draws a representation of the data within the dataArea region. The info and crosshairState arguments may be null.

Parameters: g2 the graphics device. dataArea the region in which the data is to be drawn. info an optional object for collection dimension information. crosshairState collects crosshair information (null permitted).

setData

public void setData(float[][] data)
Sets the data array used by the plot and sends a PlotChangeEvent to all registered listeners.

Parameters: data the data array (null permitted).

See Also: getData

setDomainAxis

public void setDomainAxis(ValueAxis axis)
Sets the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters: axis the axis (null not permitted).

Since: 1.0.3

See Also: getDomainAxis

setDomainGridlinePaint

public void setDomainGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getDomainGridlinePaint

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: getDomainGridlinePaint

setDomainGridlineStroke

public void setDomainGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis and sends a PlotChangeEvent to all registered listeners.

Parameters: stroke the stroke (null not permitted).

See Also: getDomainGridlineStroke

setPaint

public void setPaint(Paint paint)
Sets the color for the data points and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getPaint

setRangeAxis

public void setRangeAxis(ValueAxis axis)
Sets the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters: axis the axis (null not permitted).

Since: 1.0.3

See Also: getRangeAxis

setRangeGridlinePaint

public void setRangeGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getRangeGridlinePaint

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

setRangeGridlineStroke

public void setRangeGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.

Parameters: stroke the stroke (null permitted).

See Also: getRangeGridlineStroke

zoomDomainAxes

public void zoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the domain axis by the specified factor.

Parameters: factor the zoom factor. info the plot rendering info. source the source point.

zoomDomainAxes

public void zoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the domain axis by the specified factor.

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

Since: 1.0.7

See Also:

zoomDomainAxes

public void zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the domain axes.

Parameters: lowerPercent the new lower bound as a percentage of the current range. upperPercent the new upper bound as a percentage of the current range. info the plot rendering info. source the source point.

zoomRangeAxes

public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the range axis/axes by the specified factor.

Parameters: factor the zoom factor. info the plot rendering info. source the source point.

zoomRangeAxes

public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the range axis by the specified factor.

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

Since: 1.0.7

See Also:

zoomRangeAxes

public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the range axes.

Parameters: lowerPercent the new lower bound as a percentage of the current range. upperPercent the new upper bound as a percentage of the current range. info the plot rendering info. source the source point.