Labeling Axes
Namespace: , it defines options for the scale title. Note that this only applies to cartesian axes.
Creating Custom Tick Formats
It is also common to want to change the tick marks to include information about the data type. For example, adding a dollar sign (‘$’). To do this, you need to override the ticks.callback
method in the axis configuration.
value
- the tick value in the internal data format of the associated scale.ticks
- the array containing all of the .
The call to the method is scoped to the scale. this
inside the method is the scale object.
If the callback returns null
or undefined
the associated grid line will be hidden.
The category axis, which is the default x-axis for line and bar charts, uses the index
as internal data format. For accessing the label, use .
In the following example, every label of the Y-axis would be displayed with a dollar sign at the front.