| `fontStyle` | `string` | `'normal'` | Font style for the tick labels, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
| `lineHeight` | <code>number|string</code> | `1.2` | Height of an individual line of text (see [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height)).
| `reverse` | `boolean` | `false` | Reverses order of tick labels.
+| `lineWidth` | `number` | `0` | Stroke width around the text.
| `minor` | `object` | `{}` | Minor ticks configuration. Omitted options are inherited from options above.
| `major` | `object` | `{}` | Major ticks configuration. Omitted options are inherited from options above.
| `padding` | `number` | `0` | Sets the offset of the tick labels from the axis
+| `strokeStyle` | `string` | `` | The color of the stroke around the text.
| `z` | `number` | `0` | z-index of tick layer. Useful when ticks are drawn on chart area. Values <= 0 are drawn under datasets, > 0 on top.
## Minor Tick Configuration
minRotation: 0,
maxRotation: 50,
mirror: false,
+ lineWidth: 0,
+ strokeStyle: '',
padding: 0,
display: true,
autoSkip: true,
fontStyle: valueOrDefault(nestedOpts.fontStyle, options.fontStyle),
lineHeight: valueOrDefault(nestedOpts.lineHeight, options.lineHeight)
}), {
- color: resolve([nestedOpts.fontColor, options.fontColor, defaults.fontColor])
+ color: resolve([nestedOpts.fontColor, options.fontColor, defaults.fontColor]),
+ lineWidth: valueOrDefault(nestedOpts.lineWidth, options.lineWidth),
+ strokeStyle: valueOrDefault(nestedOpts.strokeStyle, options.strokeStyle)
});
}
for (i = 0, ilen = items.length; i < ilen; ++i) {
const item = items[i];
const tickFont = item.font;
+ const useStroke = tickFont.lineWidth > 0 && tickFont.strokeStyle !== '';
// Make sure we draw text in the correct color and font
ctx.save();
ctx.textBaseline = 'middle';
ctx.textAlign = item.textAlign;
+ if (useStroke) {
+ ctx.strokeStyle = tickFont.strokeStyle;
+ ctx.lineWidth = tickFont.lineWidth;
+ }
+
const label = item.label;
let y = item.textOffset;
if (isArray(label)) {
for (j = 0, jlen = label.length; j < jlen; ++j) {
// We just make sure the multiline element is a string here..
+ if (useStroke) {
+ ctx.strokeText('' + label[j], 0, y);
+ }
ctx.fillText('' + label[j], 0, y);
y += tickFont.lineHeight;
}
} else {
+ if (useStroke) {
+ ctx.strokeText(label, 0, y);
+ }
ctx.fillText(label, 0, y);
}
ctx.restore();