Support multiple font colors for radial chart labels (#5240)

* Support multiple font colors in array

* Address linting error
This commit is contained in:
Laura Cressman
2018-02-14 21:22:19 -05:00
committed by Evert Timberg
parent 584d1c646c
commit d6ce5c0772
2 changed files with 2 additions and 3 deletions

View File

@@ -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.

View File

@@ -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;