Class ScatterSeries


public class ScatterSeries extends XYSeries

Unconnected points. Giving the points sizes turns it into a bubble chart: the bubble's area, not its radius, is proportional to the size value, so big values do not look quadratically bigger than they are.

A scatter chart A bubble chart

  • Constructor Details

    • ScatterSeries

      public ScatterSeries(String name)

      Creates an empty scatter series.

      Parameters
      • name: the legend name
  • Method Details

    • setSizes

      public ScatterSeries setSizes(double... sizes)
      Sets a size per point of the points the series holds now, making this a bubble series; null for plain points. A point past the end of sizes, or with a NaN size, is drawn as a plain dot. Sizes move with their points as points are added, removed or slide out of a setMaxPoints window; use setData(double[], double[], double[]) or add(double, double, double) to give new points theirs.
    • setData

      public ScatterSeries setData(double[] x, double[] y, double[] sizes)

      Replaces all points with bubbles of the given sizes.

      Parameters
      • x: x values, or null for 0, 1, 2...

      • y: the values

      • sizes: one size per point, NaN for a plain dot; null for plain points, as setSizes(null) does

    • add

      public ScatterSeries add(double x, double y, double size)

      Appends a bubble, sliding the window when a maximum is set.

      Parameters
      • x: the x value

      • y: the value

      • size: the bubble size, NaN for a plain dot

    • getSize

      public double getSize(int i)
      The size of point i, NaN when it has none.
    • isAuxRelative

      protected boolean isAuxRelative(int channel)
      Description copied from class: XYSeries

      True when extra channel channel is a value on the y scale (a high, a low, a quartile) and so animates as an offset from the point's value; false for a channel of its own scale, such as a bubble size, which animates by itself.

      Parameters
      • channel: the extra channel
      Returns

      true by default

      Overrides:
      isAuxRelative in class XYSeries
    • auxDefault

      protected double auxDefault(int channel, double y)
      Overrides:
      auxDefault in class XYSeries
    • setPointSize

      public ScatterSeries setPointSize(float mm)
      Diameter of plain points in millimetres.
    • setMaxBubbleSize

      public ScatterSeries setMaxBubbleSize(float mm)
      Diameter of the largest bubble in millimetres.
    • paint

      public void paint(ChartContext ctx)
      Description copied from class: Series

      Paints the series.

      Parameters
      • ctx: the current frame: graphics, plot area, axes and animation progress
      Specified by:
      paint in class Series
    • hitTest

      public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)
      Description copied from class: Series

      Finds the data point nearest a screen position.

      Parameters
      • ctx: the frame the series was last painted in

      • x: chart relative x

      • y: chart relative y

      • radius: how far from the point a touch may land and still hit it

      Returns

      the point, or null

      Overrides:
      hitTest in class XYSeries
    • getPointCount

      public int getPointCount()
      Description copied from class: Series
      The number of points along x, for a shared tooltip; -1 when not index aligned.
      Overrides:
      getPointCount in class XYSeries
    • getSelectablePointCount

      public int getSelectablePointCount()
      Description copied from class: Series
      The number of points Chart.setSelection and arrow-key stepping can reach by index. The same as getPointCount(), except for a series whose points are not index aligned with other series (scatter), which still has its own points to select.
      Overrides:
      getSelectablePointCount in class Series
    • getXBounds

      public double[] getXBounds()
      Description copied from class: Series
      The extent of the data along x, {min, max}, or null when empty or not cartesian.
      Overrides:
      getXBounds in class XYSeries
    • getYBounds

      public double[] getYBounds()
      Description copied from class: Series
      The extent of the data along y, {min, max}, or null when empty or not cartesian.
      Overrides:
      getYBounds in class XYSeries