Skip to Main Content
Learn Chart.js
book

Learn Chart.js

by Helder da Rocha
February 2019
Beginner to intermediate content levelBeginner to intermediate
284 pages
6h 20m
English
Packt Publishing
Content preview from Learn Chart.js

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: ..., ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro D3.js: Use D3.js to Create Maintainable, Modular, and Testable Charts

Pro D3.js: Use D3.js to Create Maintainable, Modular, and Testable Charts

Marcos Iglesias

Publisher Resources

ISBN: 9781789342482OtherErrata PagePurchase Link