Class Ticks
java.lang.Object
com.codename1.ui.chart.axis.Ticks
"Nice number" tick generation: steps of 1, 2, 2.5 or 5 times a power of ten, so axis
labels read as round values instead of whatever the data range happened to divide into.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intdecimalsFor(double step) The decimal places needed to print every multiple ofstepexactly.static double[]linear(double min, double max, int maxCount) Generates ticks covering[min, max]with at mostmaxCountticks.static doubleniceStep(double rough) Returns a round step close torough.
-
Method Details
-
niceStep
public static double niceStep(double rough) Returns a round step close to
rough.Parameters
rough: the unrounded step,range / desiredTickCount
Returns
the nice step, always positive; 1 for a degenerate input
-
linear
public static double[] linear(double min, double max, int maxCount) Generates ticks covering
[min, max]with at mostmaxCountticks.Parameters
-
min: the visible minimum -
max: the visible maximum -
maxCount: the largest number of ticks the space allows, at least 2
Returns
the tick values inside
[min, max], ascending -
-
decimalsFor
public static int decimalsFor(double step) The decimal places needed to print every multiple of
stepexactly.Parameters
step: the tick step
Returns
0 for integral steps, otherwise the number of significant decimals (capped at 10)
-