From: Tanner Linsley Date: Mon, 21 Sep 2015 19:04:41 +0000 (-0600) Subject: Time scale support X-Git-Tag: 2.0.0-alpha4~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1474%2Fhead;p=thirdparty%2FChart.js.git Time scale support --- diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 140ff7229..87909d0cf 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -214,7 +214,15 @@ // Functions needed for bar charts calculateBaseWidth: function() { - return (this.getPixelForValue(null, this.smallestLabelSeparation / this.tickRange, 0, true) - this.getPixelForValue(null, 0, 0, true)) - (2 * this.options.categorySpacing); + + var base = this.getPixelForValue(null, this.smallestLabelSeparation / this.tickRange, 0, true) - this.getPixelForValue(null, 0, 0, true); + var spacing = 2 * this.options.categorySpacing; + if (base < spacing * 2) { + var mod = Math.min((spacing * 2) / base, 1.5); + base = (base / 2) * mod; + return base; + } + return base - spacing; }, calculateBarWidth: function(barDatasetCount) { //The padding between datasets is to the right of each bar, providing that there are more than 1 dataset