Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class ScatterSeries
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.

Constructors
public ScatterSeries(String name) | Creates an empty scatter series. |
Methods
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. |
public ScatterSeries setData(double[] x, double[] y, double[] sizes) | Replaces all points with bubbles of the given sizes. |
public ScatterSeries add(double x, double y, double size) | Appends a bubble, sliding the window when a maximum is set. |
public double getSize(int i) | The size of point i, NaN when it has none. |
protected boolean isAuxRelative(int channel) | 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. |
protected double auxDefault(int channel, double y) | |
public ScatterSeries setPointSize(float mm) | Diameter of plain points in millimetres. |
public ScatterSeries setMaxBubbleSize(float mm) | Diameter of the largest bubble in millimetres. |
public void paint(ChartContext ctx) | Paints the series. |
public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius) | Finds the data point nearest a screen position. |
public int getPointCount() | The number of points along x, for a shared tooltip; -1 when not index aligned. |
public int getSelectablePointCount() | The number of points Chart.setSelection and arrow-key stepping can reach by index. |
public double[] getXBounds() | The extent of the data along x, {min, max}, or null when empty or not cartesian. |
public double[] getYBounds() | The extent of the data along y, {min, max}, or null when empty or not cartesian. |
Inherited methods
From XYSeries
setRows, addRow, getAux, isCartesian, setData, setValues, add, add, set, clear, setMaxPoints, setStackGroup, getStackGroup, size, getX, getY, getBase, dataChanged, isGapAt, isAscending, nearestIndexOfX, animatedY, consumesStackBase, animatedAux, animatedBase, targetBase, hasOwnBase, captureTransitionStart, transitionEnded, captureEntryStart, getXBoundsWithin, getMinXSpacing, lowerBound, visibleRange, screenPosition, nearestScreenIndex, collectTableRows, tableValue, getPoint
From Series
getName, setName, getColor, setColor, isVisible, setVisible, isSecondaryAxis, setSecondaryAxis, isShowValues, setShowValues, getValueFormatter, setValueFormatter, getChart, isPointCountFromLayout, paintLegendSymbol, getLegendEntryCount, getLegendEntryName, paintLegendEntrySymbol, isLegendEntryVisible, toggleLegendEntry, formatValue, formatTooltip, handleTap, attached, detached, repaintChart, getVisibilityFraction, isGap, lerp
Constructor details
ScatterSeries
public ScatterSeries(String name)Parameters
nameString- the legend name
Method details
setSizes
public ScatterSeries setSizes(double... sizes)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)Parameters
xdouble[]- x values, or null for 0, 1, 2…
ydouble[]- the values
sizesdouble[]- 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)Parameters
xdouble- the x value
ydouble- the value
sizedouble- the bubble size, NaN for a plain dot
getSize
public double getSize(int i)i, NaN when it has none.isAuxRelative
protected boolean isAuxRelative(int 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
channelint- the extra channel
Returns
auxDefault
protected double auxDefault(int channel, double y)setPointSize
public ScatterSeries setPointSize(float mm)setMaxBubbleSize
public ScatterSeries setMaxBubbleSize(float mm)paint
public void paint(ChartContext ctx)Parameters
ctxChartContext- the current frame: graphics, plot area, axes and animation progress
hitTest
public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)Parameters
ctxChartContext- the frame the series was last painted in
xint- chart relative x
yint- chart relative y
radiusint- how far from the point a touch may land and still hit it
Returns
getPointCount
public int getPointCount()getSelectablePointCount
public int getSelectablePointCount()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.getXBounds
public double[] getXBounds(){min, max}, or null when empty or not cartesian.getYBounds
public double[] getYBounds(){min, max}, or null when empty or not cartesian.