allow callback or userCallback in the time scale

This commit is contained in:
Evert Timberg 2016-05-09 18:14:25 -04:00 committed by Tanner Linsley
parent 23722a8b25
commit ebffa52dc2

View File

@ -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;
} }