Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class 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
From Axis
getPosition, setPosition, isVertical, getTitle, setTitle, isVisible, setVisible, isGridVisible, setGridVisible, getFormatter, setFormatter, setRange, isMinFixed, isMaxFixed, setIncludeZero, isIncludeZero, setMaxZoom, isZoomEnabled, setZoomEnabled, setDataBounds, getDataMin, getDataMax, getVisibleMin, getVisibleMax, setVisibleRange, setDisplayRange, restoreViewport, resetViewport, isZoomed, zoom, pan, forward, inverse, toNormalized, fromNormalized, format, formatNumber
Constructor details
TimeAxis
public TimeAxis(int position)Creates a time axis.
Parameters
positionint- one of
Axis.BOTTOM,Axis.LEFT,Axis.RIGHTorAxis.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
anchordouble- 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
mindouble- the raw minimum
maxdouble- the raw maximum
Returns
{min, max} to useticks
public double[] ticks(int maxCount)Ticks for the visible range.
Parameters
maxCountint- 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.