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

public class TimeAxis

  1. Object
  2. Axis
  3. TimeAxis
A time axis whose values are milliseconds since the epoch. Ticks land on calendar boundaries (whole minutes, midnights, first of the month, new year) and the label format follows the tick unit, so zooming from years down to milliseconds stays readable.

Constructors

public TimeAxis(int position)Creates a time axis.

Methods

protected double flatPad(double anchor)One hour each side of a single timestamp, rather than 10% of its epoch milliseconds.
protected double[] adjustBounds(double min, double max)Lets a subclass pad or round the automatic bounds; the default rounds a numeric range outward to the nearest nice step so the outermost grid lines sit on the plot edge.
public double[] ticks(int maxCount)Ticks for the visible range.
protected String defaultFormat(double value, double step)The axis’ built in formatting; numbers are grouped and localized.

Inherited fields

Inherited methods

Constructor details

TimeAxis

public TimeAxis(int position)
Creates a time axis.

Parameters

position int
one of Axis.BOTTOM, Axis.LEFT, Axis.RIGHT or Axis.TOP

Method details

flatPad

protected double flatPad(double anchor)
One hour each side of a single timestamp, rather than 10% of its epoch milliseconds.

Parameters

anchor double
the single value

Returns

the pad, positive

adjustBounds

protected double[] adjustBounds(double min, double max)
Lets a subclass pad or round the automatic bounds; the default rounds a numeric range outward to the nearest nice step so the outermost grid lines sit on the plot edge.

Parameters

min double
the raw minimum
max double
the raw maximum

Returns

{min, max} to use

ticks

public double[] ticks(int maxCount)
Ticks for the visible range.

Parameters

maxCount int
the most ticks the measured label size allows

Returns

ascending tick values

defaultFormat

protected String defaultFormat(double value, double step)
The axis’ built in formatting; numbers are grouped and localized.