Sets the text labels to be used on the axis.
This method is typically used to set the x-axis to enumerated scale. In enumerated scale, the data points are associated with the x-axis by position. The first data point will be plotted at the first label position on the x-axis, the second data point at the second label position, and so on.
Enumerated axis is a very flexible axis type. It is most suitable for chart types where the data points are evenly spaced on the x-axis. The axis labels can be any text. They do not need to be numbers or dates. If they are numbers or dates, you can format them in any way you like before calling this method.
Internally, ChartDirector will assign a value of 0 to the first axis label, 1 to the second axis label, and so on. These values are not visible. Only the axis labels are visible. However, these values may be useful for some ChartDirector features that need to reference the axis position by value, such as adding mark lines using Axis.addMark
By default, all axis labels will be associated major ticks. To associate a label with a minor tick, use '-' as the first character of the label. To draw a label without any tick at all, use '~' as the first character of the label.
A leading '-' or '~' character is treated as a tick specification character and will not appear on the labels. It just specifies the the tick style to be associated with the labels. If you want have a label that actually begins with '-' or '~', you may start the label with '\-' or '\~' instead.
One common issue is that there may be too many labels on the axis. In this case, the Axis.setLabelStep
method may be used show only a regularly spaced subset of labels on the axis.
Another method is to remove some labels is to replace them with empty strings before passing them to ChartDirector. If you want to remove the label text but leave a major tick, use a space character " " as the label text. If you want to remove the label text but leave a major tick, use "-" as the label text.
object representing the prototype of the axis labels. This may be used to fine-tune the appearance of the axis labels.
© 2021 Advanced Software Engineering Limited. All rights reserved.