From d6ce5c0772bda8e4331df1d8e867fde7e6ee0bbe Mon Sep 17 00:00:00 2001 From: Laura Cressman Date: Wed, 14 Feb 2018 21:22:19 -0500 Subject: [PATCH] Support multiple font colors for radial chart labels (#5240) * Support multiple font colors in array * Address linting error --- docs/axes/radial/linear.md | 2 +- src/scales/scale.radialLinear.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/axes/radial/linear.md b/docs/axes/radial/linear.md index adebe77cc61..14009be6a5c 100644 --- a/docs/axes/radial/linear.md +++ b/docs/axes/radial/linear.md @@ -104,7 +104,7 @@ The following options are used to configure the point labels that are shown on t | Name | Type | Default | Description | -----| ---- | --------| ----------- | `callback` | `Function` | | Callback function to transform data labels to point labels. The default implementation simply returns the current string. -| `fontColor` | `Color` | `'#666'` | Font color for point labels. +| `fontColor` | `Color/Color[]` | `'#666'` | Font color for point labels. | `fontFamily` | `String` | `"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"` | Font family to use when rendering labels. | `fontSize` | `Number` | 10 | font size in pixels | `fontStyle` | `String` | `'normal'` | Font style to use when rendering point labels. diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index 9f59f17887a..e36b4e13539 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -237,7 +237,6 @@ module.exports = function(Chart) { function drawPointLabels(scale) { var ctx = scale.ctx; - var valueOrDefault = helpers.valueOrDefault; var opts = scale.options; var angleLineOpts = opts.angleLines; var pointLabelOpts = opts.pointLabels; @@ -267,7 +266,7 @@ module.exports = function(Chart) { var pointLabelPosition = scale.getPointPosition(i, outerDistance + 5); // Keep this in loop since we may support array properties here - var pointLabelFontColor = valueOrDefault(pointLabelOpts.fontColor, globalDefaults.defaultFontColor); + var pointLabelFontColor = helpers.valueAtIndexOrDefault(pointLabelOpts.fontColor, i, globalDefaults.defaultFontColor); ctx.font = plFont.font; ctx.fillStyle = pointLabelFontColor;