From: Aaron Miller Date: Sun, 13 Mar 2016 13:59:19 +0000 (-0400) Subject: Add angleLineInterval option to radar chart X-Git-Tag: v1.1.0~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2093%2Fhead;p=thirdparty%2FChart.js.git Add angleLineInterval option to radar chart --- diff --git a/docs/03-Radar-Chart.md b/docs/03-Radar-Chart.md index aff5a00db..35b3244e8 100644 --- a/docs/03-Radar-Chart.md +++ b/docs/03-Radar-Chart.md @@ -76,6 +76,9 @@ These are the customisation options specific to Radar charts. These options are //Number - Pixel width of the angle line angleLineWidth : 1, + //Number - Interval at which to draw angle lines ("every Nth point") + angleLineInterval: 1, + //String - Point label font declaration pointLabelFontFamily : "'Arial'", @@ -174,4 +177,4 @@ Calling `removeData()` on your Chart instance will remove the first value for al ```javascript myRadarChart.removeData(); // Other points will now animate to their correct positions. -``` \ No newline at end of file +``` diff --git a/src/Chart.Core.js b/src/Chart.Core.js index 979a91b7c..3fb3b2ca4 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -2058,7 +2058,7 @@ for (var i = this.valuesCount - 1; i >= 0; i--) { var centerOffset = null, outerPosition = null; - if (this.angleLineWidth > 0){ + if (this.angleLineWidth > 0 && (i % this.angleLineInterval === 0)){ centerOffset = this.calculateCenterOffset(this.max); outerPosition = this.getPointPosition(i, centerOffset); ctx.beginPath(); diff --git a/src/Chart.Radar.js b/src/Chart.Radar.js index 93d7352fd..c45e09761 100644 --- a/src/Chart.Radar.js +++ b/src/Chart.Radar.js @@ -28,6 +28,9 @@ //Number - Pixel width of the angle line angleLineWidth : 1, + //Number - Interval at which to draw angle lines ("every Nth point") + angleLineInterval: 1, + //String - Point label font declaration pointLabelFontFamily : "'Arial'", @@ -181,6 +184,7 @@ lineColor: this.options.scaleLineColor, angleLineColor : this.options.angleLineColor, angleLineWidth : (this.options.angleShowLineOut) ? this.options.angleLineWidth : 0, + angleLineInterval: (this.options.angleLineInterval) ? this.options.angleLineInterval : 1, // Point labels at the edge of each line pointLabelFontColor : this.options.pointLabelFontColor, pointLabelFontSize : this.options.pointLabelFontSize,