Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class BarSeries

  1. Object
  2. Series
  3. XYSeries
  4. BarSeries

Known subtypesHistogramSeries, RangeBarSeries, VolumeSeries, WaterfallSeries

Vertical columns, or horizontal bars when the chart is rotated. Several bar series side by side form groups; bar series sharing a stack group stack instead.

Grouped bars Stacked bars Horizontal bars

Constructors

public BarSeries(String name)Creates an empty bar series.
protected BarSeries(String name, int auxChannels)Creates a bar series that keeps extra values per bar, for range and waterfall bars.

Methods

public BarSeries setBarFraction(float f)The share of each category band the bar group fills, 0.1 to 1.
public BarSeries setCornerRadius(float mm)The radius of the bar’s outer corners in millimetres; 0 for square bars.
protected boolean consumesStackBase()True for a series drawn on its stack base (an area or a bar), which a stack group lifts and whose layer shrinks with the fraction it is shown while it fades; false for marks that keep their own values (scatter, error bars, candles, boxes).
public double[] getYBounds()The extent of the data along y, {min, max}, or null when empty or not cartesian.
public double[] getXBounds()The extent of the data along x, {min, max}, or null when empty or not cartesian.
public void paint(ChartContext ctx)Paints the series.
protected int colorAt(ChartContext ctx, int i)The fill colour of bar i; the series colour unless a subclass colours bars by value.
public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)Finds the data point nearest a screen position.

Inherited methods

Constructor details

BarSeries

public BarSeries(String name)
Creates an empty bar series.

Parameters

name String
the legend name

BarSeries

protected BarSeries(String name, int auxChannels)
Creates a bar series that keeps extra values per bar, for range and waterfall bars.

Parameters

name String
the series name
auxChannels int
number of extra values per bar

Method details

setBarFraction

public BarSeries setBarFraction(float f)
The share of each category band the bar group fills, 0.1 to 1.

setCornerRadius

public BarSeries setCornerRadius(float mm)
The radius of the bar’s outer corners in millimetres; 0 for square bars.

consumesStackBase

protected boolean consumesStackBase()
True for a series drawn on its stack base (an area or a bar), which a stack group lifts and whose layer shrinks with the fraction it is shown while it fades; false for marks that keep their own values (scatter, error bars, candles, boxes).

Returns

false by default

getYBounds

public double[] getYBounds()
The extent of the data along y, {min, max}, or null when empty or not cartesian.

getXBounds

public double[] getXBounds()
The extent of the data along x, {min, max}, or null when empty or not cartesian.

paint

public void paint(ChartContext ctx)
Paints the series.

Parameters

ctx ChartContext
the current frame: graphics, plot area, axes and animation progress

colorAt

protected int colorAt(ChartContext ctx, int i)
The fill colour of bar i; the series colour unless a subclass colours bars by value.

Parameters

ctx ChartContext
the paint context
i int
the bar index

Returns

an RGB colour

hitTest

public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)
Finds the data point nearest a screen position.

Parameters

ctx ChartContext
the frame the series was last painted in
x int
chart relative x
y int
chart relative y
radius int
how far from the point a touch may land and still hit it

Returns

the point, or null