From: pijey Date: Wed, 25 Mar 2015 10:51:56 +0000 (+0100) Subject: Add offsetGridLines option to Line charts X-Git-Tag: v2.0-alpha~42^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1025%2Fhead;p=thirdparty%2FChart.js.git Add offsetGridLines option to Line charts --- diff --git a/docs/01-Line-Chart.md b/docs/01-Line-Chart.md index 1a5ae84c4..8d164ffb2 100644 --- a/docs/01-Line-Chart.md +++ b/docs/01-Line-Chart.md @@ -102,6 +102,9 @@ These are the customisation options specific to Line charts. These options are m //String - A legend template legendTemplate : "" {% endraw %} + + //Boolean - Whether to horizontally center the label and point dot inside the grid + offsetGridLines : false }; ``` diff --git a/src/Chart.Line.js b/src/Chart.Line.js index 34ad85b4d..9e5673760 100644 --- a/src/Chart.Line.js +++ b/src/Chart.Line.js @@ -50,7 +50,10 @@ datasetFill : true, //String - A legend template - legendTemplate : "" + legendTemplate : "", + + //Boolean - Whether to horizontally center the label and point dot inside the grid + offsetGridLines : false }; @@ -61,6 +64,7 @@ initialize: function(data){ //Declare the extension of the default point, to cater for the options passed in to the constructor this.PointClass = Chart.Point.extend({ + offsetGridLines : this.options.offsetGridLines, strokeWidth : this.options.pointDotStrokeWidth, radius : this.options.pointDotRadius, display: this.options.pointDot, @@ -176,6 +180,7 @@ width : this.chart.width, ctx : this.chart.ctx, textColor : this.options.scaleFontColor, + offsetGridLines : this.options.offsetGridLines, fontSize : this.options.scaleFontSize, fontStyle : this.options.scaleFontStyle, fontFamily : this.options.scaleFontFamily,