]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix time scale grid lines 2475/head
authorEvert Timberg <evert.timberg+github@gmail.com>
Fri, 6 May 2016 11:57:28 +0000 (07:57 -0400)
committerEvert Timberg <evert.timberg+github@gmail.com>
Fri, 6 May 2016 11:57:28 +0000 (07:57 -0400)
src/scales/scale.time.js

index 2feeda86392621b315299250ef4139896cbb4121..b57a09113961531ba8a8326e9013b89ae236bb25 100644 (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;