Class FastScatterPlot

java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.FastScatterPlot
All Implemented Interfaces:
Serializable, Cloneable, EventListener, AxisChangeListener, ValueAxisPlot, DatasetChangeListener

public class FastScatterPlot
extends Plot
implements ValueAxisPlot, Cloneable, Serializable
A fast scatter plot.
See Also:
Serialized Form
  • Field Details

    • 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.
  • Constructor Details

    • 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 Details

    • getPlotType

      public String getPlotType()
      Returns a short string describing the plot type.
      Specified by:
      getPlotType in class Plot
      Returns:
      a short string describing the plot type.
    • 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 Paint getPaint()
      Returns the paint used to plot data points.
      Returns:
      The paint.
    • 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.
    • isDomainGridlinesVisible

      public boolean isDomainGridlinesVisible()
      Returns true if the domain gridlines are visible, and false otherwise. @return 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 Stroke getDomainGridlineStroke()
      Returns the stroke for the grid-lines (if any) plotted against the domain axis.
      Returns:
      the stroke.
    • setDomainGridlineStroke

      public void setDomainGridlineStroke​(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 Paint getDomainGridlinePaint()
      Returns the paint for the grid lines (if any) plotted against the domain axis.
      Returns:
      the paint.
    • setDomainGridlinePaint

      public void setDomainGridlinePaint​(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. @return 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 Stroke getRangeGridlineStroke()
      Returns the stroke for the grid lines (if any) plotted against the range axis.
      Returns:
      the stroke.
    • setRangeGridlineStroke

      public void setRangeGridlineStroke​(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 Paint getRangeGridlinePaint()
      Returns the paint for the grid lines (if any) plotted against the range axis.
      Returns:
      the paint.
    • setRangeGridlinePaint

      public void setRangeGridlinePaint​(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​(Graphics2D g2, 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​(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).
    • 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.
    • zoomHorizontalAxes

      public void zoomHorizontalAxes​(double factor)
      Multiplies the range on the horizontal axis/axes by the specified factor (not yet implemented).
      Specified by:
      zoomHorizontalAxes in interface ValueAxisPlot
      Parameters:
      factor - the zoom factor.
    • zoomHorizontalAxes

      public void zoomHorizontalAxes​(double lowerPercent, double upperPercent)
      Zooms in on the horizontal axes (not yet implemented).
      Specified by:
      zoomHorizontalAxes in interface ValueAxisPlot
      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.
    • zoomVerticalAxes

      public void zoomVerticalAxes​(double factor)
      Multiplies the range on the vertical axis/axes by the specified factor (not yet implemented).
      Specified by:
      zoomVerticalAxes in interface ValueAxisPlot
      Parameters:
      factor - the zoom factor.
    • zoomVerticalAxes

      public void zoomVerticalAxes​(double lowerPercent, double upperPercent)
      Zooms in on the vertical axes (not yet implemented).
      Specified by:
      zoomVerticalAxes in interface ValueAxisPlot
      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.
    • equals

      public boolean equals​(Object object)
      Tests an object for equality with this instance.
      Overrides:
      equals in class Plot
      Parameters:
      object - the object to test.
      Returns:
      A boolean.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone of the plot.
      Overrides:
      clone in class Plot
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - if some component of the plot does not support cloning.