org.jfree.chart.plot

Class FastScatterPlot

Implemented Interfaces:
Cloneable, EventListener, Serializable, AxisChangeListener, DatasetChangeListener, LegendItemSource, MarkerChangeListener, PublicCloneable, Serializable, ValueAxisPlot, Zoomable

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

A fast scatter plot.

Field Summary

static Paint
DEFAULT_GRIDLINE_PAINT
The default grid line paint.
static Stroke
DEFAULT_GRIDLINE_STROKE
The default grid line stroke.
protected static ResourceBundle
localizationResources
The resourceBundle for the localization.

Fields inherited from class org.jfree.chart.plot.Plot

DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_LEGEND_ITEM_BOX, DEFAULT_LEGEND_ITEM_CIRCLE, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO

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

Object
clone()
Returns a clone of the plot.
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).
protected void
drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot, if they are visible.
protected void
drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks)
Draws the gridlines for the plot, if they are visible.
boolean
equals(Object obj)
Tests an object for equality with this instance.
float[][]
getData()
Returns the data array used by the plot.
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.
ValueAxis
getDomainAxis()
Returns the domain axis for the plot.
Paint
getDomainGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the domain axis.
Stroke
getDomainGridlineStroke()
Returns the stroke for the grid-lines (if any) plotted against the domain axis.
PlotOrientation
getOrientation()
Returns the orientation of the plot.
Paint
getPaint()
Returns the paint used to plot data points.
String
getPlotType()
Returns a short string describing the plot type.
ValueAxis
getRangeAxis()
Returns the range axis for the plot.
Paint
getRangeGridlinePaint()
Returns the paint for the grid lines (if any) plotted against the range axis.
Stroke
getRangeGridlineStroke()
Returns the stroke for the grid lines (if any) plotted against the range axis.
boolean
isDomainGridlinesVisible()
Returns true if the domain gridlines are visible, and false otherwise.
boolean
isDomainZoomable()
Returns true.
boolean
isRangeGridlinesVisible()
Returns true if the range axis grid is visible, and false otherwise.
boolean
isRangeZoomable()
Returns true.
void
render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState)
Draws a representation of the data within the dataArea region.
void
setData(float[][] data)
Sets the data array used by the plot and sends a PlotChangeEvent to all registered listeners.
void
setDomainAxis(ValueAxis axis)
Sets the domain axis and sends a PlotChangeEvent to all registered listeners.
void
setDomainGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the domain axis and sends a PlotChangeEvent to all registered listeners.
void
setDomainGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis and sends a PlotChangeEvent to all registered listeners.
void
setDomainGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the domain grid-lines are visible.
void
setPaint(Paint paint)
Sets the color for the data points and sends a PlotChangeEvent to all registered listeners.
void
setRangeAxis(ValueAxis axis)
Sets the range axis and sends a PlotChangeEvent to all registered listeners.
void
setRangeGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.
void
setRangeGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis and sends a PlotChangeEvent to all registered listeners.
void
setRangeGridlinesVisible(boolean visible)
Sets the flag that controls whether or not the range axis grid lines are visible.
void
zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the domain axes.
void
zoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the domain axis/axes by the specified factor.
void
zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the range axes.
void
zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the range axis/axes by the specified factor.

Methods inherited from class org.jfree.chart.plot.Plot

addChangeListener, axisChanged, clone, datasetChanged, draw, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, equals, fillBackground, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getLegendItems, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getPlotType, getRectX, getRectY, getRootPlot, handleClick, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setDatasetGroup, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent, zoom

Field Details

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 Details

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 Details

clone

public Object clone()
            throws CloneNotSupportedException
Returns a clone of the plot.
Overrides:
clone in interface Plot
Returns:
A clone.

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).
Overrides:
draw in interface Plot
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.
Overrides:
equals in interface Plot
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).

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.
Specified by:
getDataRange in interface ValueAxisPlot
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).

getDomainGridlinePaint

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

getDomainGridlineStroke

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

getOrientation

public PlotOrientation getOrientation()
Returns the orientation of the plot.
Specified by:
getOrientation in interface Zoomable
Returns:
The orientation (always PlotOrientation.VERTICAL).

getPaint

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

getPlotType

public String getPlotType()
Returns a short string describing the plot type.
Overrides:
getPlotType in interface Plot
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).

getRangeGridlinePaint

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

getRangeGridlineStroke

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

isDomainGridlinesVisible

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

isDomainZoomable

public boolean isDomainZoomable()
Returns true.
Specified by:
isDomainZoomable in interface Zoomable
Returns:
A boolean.

isRangeGridlinesVisible

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

isRangeZoomable

public boolean isRangeZoomable()
Returns true.
Specified by:
isRangeZoomable in interface Zoomable
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

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

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

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.

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

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

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

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.

zoomDomainAxes

public void zoomDomainAxes(double lowerPercent,
                           double upperPercent,
                           PlotRenderingInfo info,
                           Point2D source)
Zooms in on the domain axes.
Specified by:
zoomDomainAxes in interface Zoomable
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.

zoomDomainAxes

public void zoomDomainAxes(double factor,
                           PlotRenderingInfo info,
                           Point2D source)
Multiplies the range on the domain axis/axes by the specified factor.
Specified by:
zoomDomainAxes in interface Zoomable
Parameters:
factor - the zoom factor.
info - the plot rendering info.
source - the source point.

zoomRangeAxes

public void zoomRangeAxes(double lowerPercent,
                          double upperPercent,
                          PlotRenderingInfo info,
                          Point2D source)
Zooms in on the range axes.
Specified by:
zoomRangeAxes in interface Zoomable
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.
Specified by:
zoomRangeAxes in interface Zoomable
Parameters:
factor - the zoom factor.
info - the plot rendering info.
source - the source point.