From a687749ed4ecdf6d6fb1a0e7c5b1774837463954 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Tue, 7 Jun 2016 20:09:33 -0400 Subject: [PATCH] Radial linear scale array properties for line width and color --- docs/02-Scales.md | 4 ++-- samples/radar.html | 3 +++ src/scales/scale.radialLinear.js | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/02-Scales.md b/docs/02-Scales.md index d0531a00d..89a30beb1 100644 --- a/docs/02-Scales.md +++ b/docs/02-Scales.md @@ -44,8 +44,8 @@ The grid line configuration is nested under the scale configuration in the `grid Name | Type | Default | Description --- | --- | --- | --- display | Boolean | true | -color | Color | "rgba(0, 0, 0, 0.1)" | Color of the grid lines. -lineWidth | Number | 1 | Stroke width of grid lines +color | Color or Array[Color] | "rgba(0, 0, 0, 0.1)" | Color of the grid lines. +lineWidth | Number or Array[Number] | 1 | Stroke width of grid lines drawBorder | Boolean | true | If true draw border on the edge of the chart drawOnChartArea | Boolean | true | If true, draw lines on the chart area inside the axis lines. This is useful when there are multiple axes and you need to control which grid lines are drawn drawTicks | Boolean | true | If true, draw lines beside the ticks in the axis area beside the chart. diff --git a/samples/radar.html b/samples/radar.html index 20ece21eb..fc888a075 100644 --- a/samples/radar.html +++ b/samples/radar.html @@ -66,6 +66,9 @@ }, scale: { reverse: false, + gridLines: { + color: ['black', 'red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'] + }, ticks: { beginAtZero: true } diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index de686eedd..e9dfe96c0 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -296,9 +296,9 @@ module.exports = function(Chart) { var yHeight = me.yCenter - yCenterOffset; // Draw circular lines around the scale - if (gridLineOpts.display) { - ctx.strokeStyle = gridLineOpts.color; - ctx.lineWidth = gridLineOpts.lineWidth; + if (gridLineOpts.display && index !== 0) { + ctx.strokeStyle = helpers.getValueAtIndexOrDefault(gridLineOpts.color, index - 1); + ctx.lineWidth = helpers.getValueAtIndexOrDefault(gridLineOpts.lineWidth, index - 1); if (opts.lineArc) { // Draw circular arcs between the points