Skip to content

Commit

Permalink
Docs/clarify usage of ticks callback (chartjs#9991)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Brunner committed Dec 15, 2021
1 parent 30bebef commit 55be827
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/axes/labelling.md
Expand Up @@ -55,6 +55,13 @@ const chart = new Chart(ctx, {
});
```

Keep in mind that overriding `ticks.callback` means that you are responsible for all formatting of the label. Depending on your use case, you may want to call the default formatter and then modify its output. In the example above, that would look like:

```javascript
// call the default formatter, forwarding `this`
return '$' + Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]);
```

Related samples:

* [Tick configuration sample](../samples/scale-options/ticks)

0 comments on commit 55be827

Please sign in to comment.