From 668b532fbee9dca9b75a5981aab949e7513a9388 Mon Sep 17 00:00:00 2001 From: Aaron Miller Date: Sun, 13 Mar 2016 09:59:19 -0400 Subject: [PATCH] Add angleLineInterval option to radar chart --- docs/03-Radar-Chart.md | 5 ++++- src/Chart.Core.js | 2 +- src/Chart.Radar.js | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) 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, -- 2.47.2