Merge pull request #2475 from chartjs/fix/2471

Fix time scale grid lines
This commit is contained in:
Evert Timberg 2016-05-07 07:55:27 -04:00
commit f3363e1d3a

View File

@ -307,6 +307,7 @@ module.exports = function(Chart) {
}
},
convertTicksToLabels: function() {
this.tickMoments = this.ticks;
this.ticks = this.ticks.map(this.tickFormatFunction, this);
},
getPixelForValue: function(value, index, datasetIndex, includeOffset) {
@ -332,6 +333,9 @@ module.exports = function(Chart) {
}
}
},
getPixelForTick: function(index, includeOffset) {
return this.getPixelForValue(this.tickMoments[index], null, null, includeOffset);
},
getValueForPixel: function(pixel) {
var innerDimension = this.isHorizontal() ? this.width - (this.paddingLeft + this.paddingRight) : this.height - (this.paddingTop + this.paddingBottom);
var offset = (pixel - (this.isHorizontal() ? this.left + this.paddingLeft : this.top + this.paddingTop)) / innerDimension;