Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class CategoryAxis
An axis of named, evenly spaced categories. Category i sits at value i, in the
middle of its band, so bars and points line up with their label.
When labels do not fit side by side the chart first rotates them, then shows every n-th one, and finally truncates with an ellipsis; it never draws them over each other.

Constructors
public CategoryAxis(int position, String... labels) | Creates a category axis. |
Methods
public CategoryAxis setCategories(String... labels) | Replaces the category names. |
public int getCategoryCount() | The number of categories. |
public String getCategory(int i) | The name of category i, or an empty string out of range. |
public void setDataBounds(double min, double max) | Called by the chart with the extent of the data on this axis. |
public double getDataLimit() | The largest x a data point may have and still open its own band; a point further out is an outlier the axis ignores. |
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. |
public double getBandWidth() | The width of one category band in normalized units, used to size bars. |
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, flatPad, getDataMin, getDataMax, getVisibleMin, getVisibleMax, setVisibleRange, setDisplayRange, restoreViewport, resetViewport, isZoomed, zoom, pan, forward, inverse, toNormalized, fromNormalized, format, formatNumber
Constructor details
CategoryAxis
public CategoryAxis(int position, String... labels)Parameters
positionint- one of
Axis.BOTTOM,Axis.LEFT,Axis.RIGHTorAxis.TOP labelsString...- the category names, in order
Method details
setCategories
public CategoryAxis setCategories(String... labels)getCategoryCount
public int getCategoryCount()getCategory
public String getCategory(int i)i, or an empty string out of range.setDataBounds
public void setDataBounds(double min, double max)Parameters
mindouble- smallest value of any visible series
maxdouble- largest value of any visible series
getDataLimit
public double getDataLimit()Returns
adjustBounds
protected double[] adjustBounds(double min, double max)Parameters
mindouble- the raw minimum
maxdouble- the raw maximum
Returns
{min, max} to useticks
public double[] ticks(int maxCount)Parameters
maxCountint- the most ticks the measured label size allows
Returns
defaultFormat
protected String defaultFormat(double value, double step)getBandWidth
public double getBandWidth()