public class FastScatterPlot extends Plot implements ValueAxisPlot, Pannable, Zoomable, java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
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.
|
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 and Description |
---|
FastScatterPlot()
Creates a new instance of
FastScatterPlot with default
axes. |
FastScatterPlot(float[][] data,
ValueAxis domainAxis,
ValueAxis rangeAxis)
Creates a new fast scatter plot.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of the plot.
|
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.awt.geom.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(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 arbitrary object for equality with this plot.
|
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.
|
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 |
isDomainPannable()
Returns
true if panning is enabled for the domain axes,
and false otherwise. |
boolean |
isDomainZoomable()
Returns
true . |
boolean |
isRangeGridlinesVisible()
Returns
true if the range axis grid is visible, and
false otherwise. |
boolean |
isRangePannable()
Returns
true if panning is enabled for the range axes,
and false otherwise. |
boolean |
isRangeZoomable()
Returns
true . |
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.
|
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 |
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(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the domain axis and
sends a
PlotChangeEvent to all registered listeners. |
void |
setDomainGridlineStroke(java.awt.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 |
setDomainPannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along the
domain axes.
|
void |
setPaint(java.awt.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(java.awt.Paint paint)
Sets the paint for the grid lines plotted against the range axis and
sends a
PlotChangeEvent to all registered listeners. |
void |
setRangeGridlineStroke(java.awt.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 |
setRangePannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along
the range axes.
|
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 by the specified factor.
|
void |
zoomDomainAxes(double factor,
PlotRenderingInfo info,
java.awt.geom.Point2D source,
boolean useAnchor)
Multiplies the range on the domain axis 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 by the specified factor.
|
addChangeListener, annotationChanged, axisChanged, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getLegendItems, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isNotify, isOutlineVisible, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
public static final java.awt.Stroke DEFAULT_GRIDLINE_STROKE
public static final java.awt.Paint DEFAULT_GRIDLINE_PAINT
protected static java.util.ResourceBundle localizationResources
public FastScatterPlot()
FastScatterPlot
with default
axes.public FastScatterPlot(float[][] data, ValueAxis domainAxis, ValueAxis rangeAxis)
The data is an array of x, y values: data[0][i] = x, data[1][i] = y.
data
- the data (null
permitted).domainAxis
- the domain (x) axis (null
not permitted).rangeAxis
- the range (y) axis (null
not permitted).public java.lang.String getPlotType()
getPlotType
in class Plot
public float[][] getData()
null
).setData(float[][])
public void setData(float[][] data)
PlotChangeEvent
to all registered listeners.data
- the data array (null
permitted).getData()
public PlotOrientation getOrientation()
getOrientation
in interface Pannable
getOrientation
in interface Zoomable
PlotOrientation.VERTICAL
).public ValueAxis getDomainAxis()
null
).setDomainAxis(ValueAxis)
public void setDomainAxis(ValueAxis axis)
PlotChangeEvent
to all
registered listeners.axis
- the axis (null
not permitted).getDomainAxis()
public ValueAxis getRangeAxis()
null
).setRangeAxis(ValueAxis)
public void setRangeAxis(ValueAxis axis)
PlotChangeEvent
to all
registered listeners.axis
- the axis (null
not permitted).getRangeAxis()
public java.awt.Paint getPaint()
Color.red
.setPaint(Paint)
public void setPaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getPaint()
public boolean isDomainGridlinesVisible()
true
if the domain gridlines are visible, and
false
otherwise.true
or false
.setDomainGridlinesVisible(boolean)
,
setDomainGridlinePaint(Paint)
public void setDomainGridlinesVisible(boolean visible)
PlotChangeEvent
is
sent to all registered listeners.visible
- the new value of the flag.getDomainGridlinePaint()
public java.awt.Stroke getDomainGridlineStroke()
null
).setDomainGridlineStroke(Stroke)
public void setDomainGridlineStroke(java.awt.Stroke stroke)
PlotChangeEvent
to all registered listeners.stroke
- the stroke (null
not permitted).getDomainGridlineStroke()
public java.awt.Paint getDomainGridlinePaint()
null
).setDomainGridlinePaint(Paint)
public void setDomainGridlinePaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getDomainGridlinePaint()
public boolean isRangeGridlinesVisible()
true
if the range axis grid is visible, and
false
otherwise.true
or false
.setRangeGridlinesVisible(boolean)
public void setRangeGridlinesVisible(boolean visible)
PlotChangeEvent
is
sent to all registered listeners.visible
- the new value of the flag.isRangeGridlinesVisible()
public java.awt.Stroke getRangeGridlineStroke()
null
).setRangeGridlineStroke(Stroke)
public void setRangeGridlineStroke(java.awt.Stroke stroke)
PlotChangeEvent
to all registered listeners.stroke
- the stroke (null
permitted).getRangeGridlineStroke()
public java.awt.Paint getRangeGridlinePaint()
null
).setRangeGridlinePaint(Paint)
public void setRangeGridlinePaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getRangeGridlinePaint()
public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, PlotState parentState, PlotRenderingInfo info)
draw
in class Plot
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).public void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState)
info
and crosshairState
arguments may be
null
.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).protected void drawDomainGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List ticks)
g2
- the graphics device.dataArea
- the data area.ticks
- the ticks.protected void drawRangeGridlines(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, java.util.List ticks)
g2
- the graphics device.dataArea
- the data area.ticks
- the ticks.public Range getDataRange(ValueAxis axis)
null
if the specified axis isn't the domain axis or the
range axis for the plot.getDataRange
in interface ValueAxisPlot
axis
- the axis (null
permitted).null
).public void zoomDomainAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source)
zoomDomainAxes
in interface Zoomable
factor
- the zoom factor.info
- the plot rendering info.source
- the source point.Zoomable.zoomRangeAxes(double, PlotRenderingInfo, Point2D)
public void zoomDomainAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source, boolean useAnchor)
zoomDomainAxes
in interface Zoomable
factor
- the zoom factor.info
- the plot rendering info.source
- the source point (in Java2D space).useAnchor
- use source point as zoom anchor?zoomRangeAxes(double, PlotRenderingInfo, Point2D, boolean)
public void zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, java.awt.geom.Point2D source)
zoomDomainAxes
in interface Zoomable
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.Zoomable.zoomRangeAxes(double, double, PlotRenderingInfo, Point2D)
public void zoomRangeAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source)
zoomRangeAxes
in interface Zoomable
factor
- the zoom factor.info
- the plot rendering info.source
- the source point.Zoomable.zoomDomainAxes(double, PlotRenderingInfo, Point2D)
public void zoomRangeAxes(double factor, PlotRenderingInfo info, java.awt.geom.Point2D source, boolean useAnchor)
zoomRangeAxes
in interface Zoomable
factor
- the zoom factor.info
- the plot rendering info.source
- the source point (in Java2D space).useAnchor
- use source point as zoom anchor?zoomDomainAxes(double, PlotRenderingInfo, Point2D, boolean)
public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, java.awt.geom.Point2D source)
zoomRangeAxes
in interface Zoomable
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.Zoomable.zoomDomainAxes(double, double, PlotRenderingInfo, Point2D)
public boolean isDomainZoomable()
true
.isDomainZoomable
in interface Zoomable
Zoomable.isRangeZoomable()
public boolean isRangeZoomable()
true
.isRangeZoomable
in interface Zoomable
Zoomable.isDomainZoomable()
public boolean isDomainPannable()
true
if panning is enabled for the domain axes,
and false
otherwise.isDomainPannable
in interface Pannable
public void setDomainPannable(boolean pannable)
pannable
- the new flag value.public boolean isRangePannable()
true
if panning is enabled for the range axes,
and false
otherwise.isRangePannable
in interface Pannable
public void setRangePannable(boolean pannable)
pannable
- the new flag value.public void panDomainAxes(double percent, PlotRenderingInfo info, java.awt.geom.Point2D source)
panDomainAxes
in interface Pannable
percent
- the distance to pan (as a percentage of the axis length).info
- the plot infosource
- the source point where the pan action started.public void panRangeAxes(double percent, PlotRenderingInfo info, java.awt.geom.Point2D source)
panRangeAxes
in interface Pannable
percent
- the distance to pan (as a percentage of the axis length).info
- the plot infosource
- the source point where the pan action started.public boolean equals(java.lang.Object obj)
FastScatterPlot
carries its data around with it (rather
than referencing a dataset), and the data is included in the
equality test.public java.lang.Object clone() throws java.lang.CloneNotSupportedException