x: medianPosition.x,
y: medianPosition.y,
labels: labels,
- title: this._data.labels && this._data.labels.length ? this._data.labels[this._active[0]._index] : '',
+ title: (function() {
+ return this._data.timeLabels ? this._data.timeLabels[this._active[0]._index] :
+ (this._data.labels && this._data.labels.length) ? this._data.labels[this._active[0]._index] :
+ '';
+ }).call(this),
legendColors: colors,
legendBackgroundColor: this._options.tooltips.multiKeyBackground,
});
this.labels = [];
// A map of original labelIndex to time labelIndex
this.timeLabelIndexMap = {};
+ // The time formatted versions of the labels for use by tooltips
+ this.data.timeLabels = [];
var definedMoments = [];
helpers.each(definedMoments, function(definedMoment, index) {
this.timeLabelIndexMap[index] = momentRangeLength - this.lastMoment.diff(definedMoment, this.timeUnit);
+ this.data.timeLabels.push(
+ definedMoment
+ .format(this.options.time.display ? this.options.time.display : this.displayFormat)
+ );
}, this);
// For every unit in between the first and last moment, create a moment and add it to the labels tick