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.

-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.protected StringdefaultFormat(double value, double step) The axis' built in formatting; numbers are grouped and localized.doubleThe width of one category band in normalized units, used to size bars.getCategory(int i) The name of categoryi, or an empty string out of range.intThe number of categories.doubleThe largest x a data point may have and still open its own band; a point further out is an outlier the axis ignores.setCategories(String... labels) Replaces the category names.voidsetDataBounds(double min, double max) Called by the chart with the extent of the data on this axis.double[]ticks(int maxCount) Ticks for the visible range.Methods inherited from class Axis
flatPad, format, formatNumber, forward, fromNormalized, getDataMax, getDataMin, getFormatter, getPosition, getTitle, getVisibleMax, getVisibleMin, inverse, isGridVisible, isIncludeZero, isMaxFixed, isMinFixed, isVertical, isVisible, isZoomed, isZoomEnabled, pan, resetViewport, restoreViewport, setDisplayRange, setFormatter, setGridVisible, setIncludeZero, setMaxZoom, setPosition, setRange, setTitle, setVisible, setVisibleRange, setZoomEnabled, toNormalized, zoom
-
Constructor Details
-
CategoryAxis
Creates a category axis.
Parameters
-
position: one ofAxis.BOTTOM,Axis.LEFT,Axis.RIGHTorAxis.TOP -
labels: the category names, in order
-
-
-
Method Details
-
setCategories
Replaces the category names. -
getCategoryCount
public int getCategoryCount()The number of categories. -
getCategory
The name of categoryi, or an empty string out of range. -
setDataBounds
public void setDataBounds(double min, double max) Description copied from class:AxisCalled by the chart with the extent of the data on this axis.
Parameters
-
min: smallest value of any visible series -
max: largest value of any visible series
- Overrides:
setDataBoundsin classAxis
-
-
getDataLimit
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.
Returns
the largest x that counts
-
adjustBounds
protected double[] adjustBounds(double min, double max) Description copied from class:AxisLets 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: the raw minimum -
max: the raw maximum
Returns
{min, max}to use- Overrides:
adjustBoundsin classAxis
-
-
ticks
-
defaultFormat
Description copied from class:AxisThe axis' built in formatting; numbers are grouped and localized.- Overrides:
defaultFormatin classAxis
-
getBandWidth
public double getBandWidth()The width of one category band in normalized units, used to size bars.
-