Configuring the axes

Category scales share the same axis configuration as numeric charts, but support some additional properties in the axis and axis.ticks objects. The axis object has one additional property that can be used to override the data object labels for an axis:

Property

Value

Description

labels

Array of String

An array of labels to display. Overrides any other definition for labels, including data object properties: labels, xLabels, or yLabels.

Additional axis configuration for category scales

The following code fragment shows category labels defined in three different properties. Since the single axis contains a labels property, it will override all previous definitions:

new Chart("my-chart", type: ..., ...

Get Learn Chart.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.