mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
allow callback or userCallback in the time scale
This commit is contained in:
parent
23722a8b25
commit
ebffa52dc2
@ -299,9 +299,11 @@ module.exports = function(Chart) {
|
|||||||
// Function to format an individual tick mark
|
// Function to format an individual tick mark
|
||||||
tickFormatFunction: function tickFormatFunction(tick, index, ticks) {
|
tickFormatFunction: function tickFormatFunction(tick, index, ticks) {
|
||||||
var formattedTick = tick.format(this.displayFormat);
|
var formattedTick = tick.format(this.displayFormat);
|
||||||
|
var tickOpts = this.options.ticks;
|
||||||
|
var callback = helpers.getValueOrDefault(tickOpts.callback, tickOpts.userCallback);
|
||||||
|
|
||||||
if (this.options.ticks.userCallback) {
|
if (callback) {
|
||||||
return this.options.ticks.userCallback(formattedTick, index, ticks);
|
return callback(formattedTick, index, ticks);
|
||||||
} else {
|
} else {
|
||||||
return formattedTick;
|
return formattedTick;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user