org.jfree.chart.plot
Class FastScatterPlot

java.lang.Object
  extended byorg.jfree.chart.plot.Plot
      extended byorg.jfree.chart.plot.FastScatterPlot
All Implemented Interfaces:
AxisChangeListener, java.lang.Cloneable, DatasetChangeListener, java.util.EventListener, LegendItemSource, java.io.Serializable, ValueAxisPlot, Zoomable

public class FastScatterPlot
extends Plot
implements ValueAxisPlot, Zoomable, java.lang.Cloneable, java.io.Serializable

A fast scatter plot.

See Also:
Serialized Form

Field Summary
static java.awt.Paint DEFAULT_GRIDLINE_PAINT
          The default grid line paint.
static java.awt.Stroke DEFAULT_GRIDLINE_STROKE
          The default grid line stroke.
protected static java.util.ResourceBundle localizationResources
          The resourceBundle for the localization.
 
Fields inherited from class org.jfree.chart.plot.Plot
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_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 an empty plot.
FastScatterPlot(float[][] data, ValueAxis domainAxis, ValueAxis rangeAxis)
          Creates a new fast scatter plot.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of the plot.
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, 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(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List ticks)
          Draws the gridlines for the plot, if they are visible.
protected  void drawRangeGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List ticks)
          Draws the gridlines for the plot, if they are visible.
 boolean equals(java.lang.Object obj)
          Tests an object for equality with this instance.
 Range getDataRange(ValueAxis axis)
          Returns the range of data values to be plotted along the axis.
 ValueAxis getDomainAxis()
          Returns the domain axis for the plot.
 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.
 PlotOrientation getOrientation()
          Returns the orientation of the plot.
 java.awt.Paint getPaint()
          Returns the paint used to plot data points.
 java.lang.String getPlotType()
          Returns a short string describing the plot type.
 ValueAxis getRangeAxis()
          Returns the range axis for the plot.
 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.
 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(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState)
          Draws a representation of the data within the dataArea region.
 void setDomainGridlinePaint(java.awt.Paint paint)
          Sets the paint for the grid lines plotted against the domain axis.
 void setDomainGridlineStroke(java.awt.Stroke stroke)
          Sets the stroke for the grid lines plotted against the domain axis.
 void setDomainGridlinesVisible(boolean visible)
          Sets the flag that controls whether or not the domain grid-lines are visible.
 void setPaint(java.awt.Paint paint)
          Sets the color for the data points and sends a PlotChangeEvent to all registered listeners.
 void setRangeGridlinePaint(java.awt.Paint paint)
          Sets the paint for the grid lines plotted against the range axis.
 void setRangeGridlineStroke(java.awt.Stroke stroke)
          Sets the stroke for the grid lines plotted against the range axis.
 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, java.awt.geom.Point2D source)
          Zooms in on the domain 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 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.
 
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, axisChanged, datasetChanged, draw, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fillBackground, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundPaint, getDataAreaRatio, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getLegendItems, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isSubplot, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundPaint, setDataAreaRatio, setDatasetGroup, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent, zoom
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.


localizationResources

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

Constructor Detail

FastScatterPlot

public FastScatterPlot()
Creates an empty plot.


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.
domainAxis - the domain (x) axis.
rangeAxis - the range (y) axis.
Method Detail

getPlotType

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

Specified by:
getPlotType in class Plot
Returns:
A short string describing the plot type.

getOrientation

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

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

getDomainAxis

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

Returns:
The domain axis.

getRangeAxis

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

Returns:
The range axis.

getPaint

public java.awt.Paint getPaint()
Returns the paint used to plot data points.

Returns:
The paint.

setPaint

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

Parameters:
paint - the paint (null not permitted).

isDomainGridlinesVisible

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

Returns:
true or false.

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.

getDomainGridlineStroke

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

Returns:
The stroke.

setDomainGridlineStroke

public void setDomainGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis.

If you set this to null, no grid lines will be drawn.

Parameters:
stroke - the stroke (null permitted).

getDomainGridlinePaint

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

Returns:
The paint.

setDomainGridlinePaint

public void setDomainGridlinePaint(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the domain axis.

If you set this to null, no grid lines will be drawn.

Parameters:
paint - the paint (null permitted).

isRangeGridlinesVisible

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

Returns:
true or false.

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.

getRangeGridlineStroke

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

Returns:
The stroke.

setRangeGridlineStroke

public void setRangeGridlineStroke(java.awt.Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis.

If you set this to null, no grid lines will be drawn.

Parameters:
stroke - the stroke (null permitted).

getRangeGridlinePaint

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

Returns:
The paint.

setRangeGridlinePaint

public void setRangeGridlinePaint(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the range axis.

If you set this to null, no grid lines will be drawn.

Parameters:
paint - the paint (null permitted).

draw

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

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

render

public void render(java.awt.Graphics2D g2,
                   java.awt.geom.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).

drawDomainGridlines

protected void drawDomainGridlines(java.awt.Graphics2D g2,
                                   java.awt.geom.Rectangle2D dataArea,
                                   java.util.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(java.awt.Graphics2D g2,
                                  java.awt.geom.Rectangle2D dataArea,
                                  java.util.List ticks)
Draws the gridlines for the plot, if they are visible.

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

getDataRange

public Range getDataRange(ValueAxis axis)
Returns the range of data values to be plotted along the axis.

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

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 interface Zoomable
Parameters:
factor - the zoom factor.
info - the plot rendering info.
source - the source point.

zoomDomainAxes

public void zoomDomainAxes(double lowerPercent,
                           double upperPercent,
                           PlotRenderingInfo info,
                           java.awt.geom.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.

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 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,
                          java.awt.geom.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.

isDomainZoomable

public boolean isDomainZoomable()
Returns true.

Specified by:
isDomainZoomable in interface Zoomable
Returns:
A boolean.

isRangeZoomable

public boolean isRangeZoomable()
Returns true.

Specified by:
isRangeZoomable in interface Zoomable
Returns:
A boolean.

equals

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

Overrides:
equals in class Plot
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

clone

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

Overrides:
clone in class Plot
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if some component of the plot does not support cloning.