- java.lang.Object
-
- org.jfree.chart.plot.Plot
-
- org.jfree.chart.plot.FastScatterPlot
-
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,PublicCloneable,ChartElement,AnnotationChangeListener,AxisChangeListener,MarkerChangeListener,org.jfree.chart.legend.LegendItemSource,Pannable,ValueAxisPlot,Zoomable,DatasetChangeListener
public class FastScatterPlot extends Plot implements ValueAxisPlot, Pannable, Zoomable, Cloneable, Serializable
A fast scatter plot.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static PaintDEFAULT_GRIDLINE_PAINTThe default grid line paint.static StrokeDEFAULT_GRIDLINE_STROKEThe default grid line stroke.protected static ResourceBundlelocalizationResourcesThe 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
Constructors Constructor Description FastScatterPlot()Creates a new instance ofFastScatterPlotwith default axes.FastScatterPlot(float[][] data, ValueAxis domainAxis, ValueAxis rangeAxis)Creates a new fast scatter plot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 arbitrary object for equality with this plot.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, ornullif 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()Returnstrueif the domain gridlines are visible, andfalseotherwise.booleanisDomainPannable()Returnstrueif panning is enabled for the domain axes, andfalseotherwise.booleanisDomainZoomable()Returnstrue.booleanisRangeGridlinesVisible()Returnstrueif the range axis grid is visible, andfalseotherwise.booleanisRangePannable()Returnstrueif panning is enabled for the range axes, andfalseotherwise.booleanisRangeZoomable()Returnstrue.voidpanDomainAxes(double percent, PlotRenderingInfo info, Point2D source)Pans the domain axes by the specified percentage.voidpanRangeAxes(double percent, PlotRenderingInfo info, Point2D source)Pans the range axes by the specified percentage.voidreceive(ChartElementVisitor visitor)Receives a chart element visitor.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 aPlotChangeEventto all registered listeners.voidsetDomainAxis(ValueAxis axis)Sets the domain axis and sends aPlotChangeEventto all registered listeners.voidsetDomainGridlinePaint(Paint paint)Sets the paint for the grid lines plotted against the domain axis and sends aPlotChangeEventto all registered listeners.voidsetDomainGridlineStroke(Stroke stroke)Sets the stroke for the grid lines plotted against the domain axis and sends aPlotChangeEventto all registered listeners.voidsetDomainGridlinesVisible(boolean visible)Sets the flag that controls whether or not the domain grid-lines are visible.voidsetDomainPannable(boolean pannable)Sets the flag that enables or disables panning of the plot along the domain axes.voidsetPaint(Paint paint)Sets the color for the data points and sends aPlotChangeEventto all registered listeners.voidsetRangeAxis(ValueAxis axis)Sets the range axis and sends aPlotChangeEventto all registered listeners.voidsetRangeGridlinePaint(Paint paint)Sets the paint for the grid lines plotted against the range axis and sends aPlotChangeEventto all registered listeners.voidsetRangeGridlineStroke(Stroke stroke)Sets the stroke for the grid lines plotted against the range axis and sends aPlotChangeEventto all registered listeners.voidsetRangeGridlinesVisible(boolean visible)Sets the flag that controls whether or not the range axis grid lines are visible.voidsetRangePannable(boolean pannable)Sets the flag that enables or disables panning of the plot along the range axes.voidzoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)Zooms in on the domain axes.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.voidzoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)Zooms in on the range 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.-
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, annotationChanged, axisChanged, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fetchElementHintingFlag, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getChart, 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, setChart, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
-
-
-
-
Field Detail
-
DEFAULT_GRIDLINE_STROKE
public static final Stroke DEFAULT_GRIDLINE_STROKE
The default grid line stroke.
-
DEFAULT_GRIDLINE_PAINT
public static final Paint DEFAULT_GRIDLINE_PAINT
The default grid line paint.
-
localizationResources
protected static ResourceBundle localizationResources
The resourceBundle for the localization.
-
-
Constructor Detail
-
FastScatterPlot
public FastScatterPlot()
Creates a new instance ofFastScatterPlotwith 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 (nullpermitted).domainAxis- the domain (x) axis (nullnot permitted).rangeAxis- the range (y) axis (nullnot permitted).
-
-
Method Detail
-
getPlotType
public String getPlotType()
Returns a short string describing the plot type.- Specified by:
getPlotTypein classPlot- Returns:
- A short string describing the plot type.
-
getData
public float[][] getData()
Returns the data array used by the plot.- Returns:
- The data array (possibly
null). - See Also:
setData(float[][])
-
setData
public void setData(float[][] data)
Sets the data array used by the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
data- the data array (nullpermitted).- See Also:
getData()
-
getOrientation
public PlotOrientation getOrientation()
Returns the orientation of the plot.- Specified by:
getOrientationin interfacePannable- Specified by:
getOrientationin interfaceZoomable- Returns:
- The orientation (always
PlotOrientation.VERTICAL).
-
getDomainAxis
public ValueAxis getDomainAxis()
Returns the domain axis for the plot.- Returns:
- The domain axis (never
null). - See Also:
setDomainAxis(ValueAxis)
-
setDomainAxis
public void setDomainAxis(ValueAxis axis)
Sets the domain axis and sends aPlotChangeEventto all registered listeners.- Parameters:
axis- the axis (nullnot permitted).- See Also:
getDomainAxis()
-
getRangeAxis
public ValueAxis getRangeAxis()
Returns the range axis for the plot.- Returns:
- The range axis (never
null). - See Also:
setRangeAxis(ValueAxis)
-
setRangeAxis
public void setRangeAxis(ValueAxis axis)
Sets the range axis and sends aPlotChangeEventto all registered listeners.- Parameters:
axis- the axis (nullnot permitted).- See Also:
getRangeAxis()
-
getPaint
public Paint getPaint()
Returns the paint used to plot data points. The default isColor.RED.- Returns:
- The paint.
- See Also:
setPaint(Paint)
-
setPaint
public void setPaint(Paint paint)
Sets the color for the data points and sends aPlotChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getPaint()
-
isDomainGridlinesVisible
public boolean isDomainGridlinesVisible()
Returnstrueif the domain gridlines are visible, andfalseotherwise.- Returns:
trueorfalse.- See Also:
setDomainGridlinesVisible(boolean),setDomainGridlinePaint(Paint)
-
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, aPlotChangeEventis sent to all registered listeners.- Parameters:
visible- the new value of the flag.- See Also:
getDomainGridlinePaint()
-
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(Stroke)
-
setDomainGridlineStroke
public void setDomainGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the domain axis and sends aPlotChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
getDomainGridlineStroke()
-
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(Paint)
-
setDomainGridlinePaint
public void setDomainGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the domain axis and sends aPlotChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getDomainGridlinePaint()
-
isRangeGridlinesVisible
public boolean isRangeGridlinesVisible()
Returnstrueif the range axis grid is visible, andfalseotherwise.- Returns:
trueorfalse.- 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, aPlotChangeEventis sent to all registered listeners.- Parameters:
visible- the new value of the flag.- See Also:
isRangeGridlinesVisible()
-
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(Stroke)
-
setRangeGridlineStroke
public void setRangeGridlineStroke(Stroke stroke)
Sets the stroke for the grid lines plotted against the range axis and sends aPlotChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullpermitted).- See Also:
getRangeGridlineStroke()
-
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(Paint)
-
setRangeGridlinePaint
public void setRangeGridlinePaint(Paint paint)
Sets the paint for the grid lines plotted against the range axis and sends aPlotChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getRangeGridlinePaint()
-
receive
public void receive(ChartElementVisitor visitor)
Receives a chart element visitor.- Specified by:
receivein interfaceChartElement- Overrides:
receivein classPlot- Parameters:
visitor- the visitor (nullnot permitted).
-
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).- Specified by:
drawin classPlot- Parameters:
g2- the graphics device.area- the area within which the plot (including axis labels) should be drawn.anchor- the anchor point (nullpermitted).parentState- the state from the parent plot (ignored).info- collects chart drawing information (nullpermitted).
-
render
public void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState)
Draws a representation of the data within the dataArea region. TheinfoandcrosshairStatearguments may benull.- 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 (nullpermitted).
-
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.
-
getDataRange
public Range getDataRange(ValueAxis axis)
Returns the range of data values to be plotted along the axis, ornullif the specified axis isn't the domain axis or the range axis for the plot.- Specified by:
getDataRangein interfaceValueAxisPlot- Parameters:
axis- the axis (nullpermitted).- Returns:
- The range (possibly
null).
-
zoomDomainAxes
public void zoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the domain axis by the specified factor.- Specified by:
zoomDomainAxesin interfaceZoomable- Parameters:
factor- the zoom factor.info- the plot rendering info.source- the source point.- See Also:
Zoomable.zoomRangeAxes(double, PlotRenderingInfo, Point2D)
-
zoomDomainAxes
public void zoomDomainAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the domain axis by the specified factor.- Specified by:
zoomDomainAxesin 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, Point2D source)
Zooms in on the domain axes.- Specified by:
zoomDomainAxesin interfaceZoomable- 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.- See Also:
Zoomable.zoomRangeAxes(double, double, PlotRenderingInfo, Point2D)
-
zoomRangeAxes
public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source)
Multiplies the range on the range axis/axes by the specified factor.- Specified by:
zoomRangeAxesin interfaceZoomable- Parameters:
factor- the zoom factor.info- the plot rendering info.source- the source point.- See Also:
Zoomable.zoomDomainAxes(double, PlotRenderingInfo, Point2D)
-
zoomRangeAxes
public void zoomRangeAxes(double factor, PlotRenderingInfo info, Point2D source, boolean useAnchor)
Multiplies the range on the range axis by the specified factor.- Specified by:
zoomRangeAxesin 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:
zoomDomainAxes(double, PlotRenderingInfo, Point2D, boolean)
-
zoomRangeAxes
public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source)
Zooms in on the range axes.- Specified by:
zoomRangeAxesin interfaceZoomable- 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.- See Also:
Zoomable.zoomDomainAxes(double, double, PlotRenderingInfo, Point2D)
-
isDomainZoomable
public boolean isDomainZoomable()
Returnstrue.- Specified by:
isDomainZoomablein interfaceZoomable- Returns:
- A boolean.
- See Also:
Zoomable.isRangeZoomable()
-
isRangeZoomable
public boolean isRangeZoomable()
Returnstrue.- Specified by:
isRangeZoomablein interfaceZoomable- Returns:
- A boolean.
- See Also:
Zoomable.isDomainZoomable()
-
isDomainPannable
public boolean isDomainPannable()
Returnstrueif panning is enabled for the domain axes, andfalseotherwise.- Specified by:
isDomainPannablein 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()
Returnstrueif panning is enabled for the range axes, andfalseotherwise.- Specified by:
isRangePannablein interfacePannable- Returns:
- A boolean.
-
setRangePannable
public void setRangePannable(boolean pannable)
Sets the flag that enables or disables panning of the plot along the range axes.- Parameters:
pannable- the new flag value.
-
panDomainAxes
public void panDomainAxes(double percent, PlotRenderingInfo info, Point2D source)
Pans the domain axes by the specified percentage.- Specified by:
panDomainAxesin 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, Point2D source)
Pans the range axes by the specified percentage.- Specified by:
panRangeAxesin 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.
-
equals
public boolean equals(Object obj)
Tests an arbitrary object for equality with this plot. Note thatFastScatterPlotcarries its data around with it (rather than referencing a dataset), and the data is included in the equality test.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of the plot.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classPlot- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if some component of the plot does not support cloning.
-
-