Skip to content

Commit

Permalink
Add description on tick label callback parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix committed Mar 23, 2019
1 parent 967ff23 commit 962eade
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/axes/labelling.md
Expand Up @@ -42,3 +42,5 @@ var chart = new Chart(ctx, {
}
});
```

The third parameter passed to the callback function is an array of labels, but in the time scale, it is an array of `{label: string, major: boolean}` objects.
6 changes: 4 additions & 2 deletions src/scales/scale.time.js
Expand Up @@ -668,8 +668,10 @@ module.exports = Scale.extend({
var label = adapter.format(time, format ? format : major ? majorFormat : minorFormat);
var nestedTickOpts = major ? majorTickOpts : tickOpts.minor;
var formatter = helpers.options.resolve([
nestedTickOpts.callback, nestedTickOpts.userCallback,
tickOpts.callback, tickOpts.userCallback
nestedTickOpts.callback,
nestedTickOpts.userCallback,
tickOpts.callback,
tickOpts.userCallback
]);

return formatter ? formatter(label, index, ticks) : label;
Expand Down

0 comments on commit 962eade

Please sign in to comment.