Skip to content

Commit

Permalink
Support multiple font colors for radial chart labels (#5240)
Browse files Browse the repository at this point in the history
* Support multiple font colors in array

* Address linting error
  • Loading branch information
flaurida authored and etimberg committed Feb 15, 2018
1 parent 584d1c6 commit d6ce5c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/axes/radial/linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 1 addition & 2 deletions src/scales/scale.radialLinear.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit d6ce5c0

Please sign in to comment.