Data Label Colors

We usually change the color of a data label, at the series level, by using the color setting under Basic > Data Labels > select a series > Label style > color. But our changes are being ignored. We tried under Advanced > Series 1 > Data Labels 1 > Color…and our changes are ignored there as well. Has anyone else run into this or know a workaround to change the color of a data label at the series level?

Hi,

I was able to produce your issue in some cases and have reported it internally.

The workaround is unfortunately tricky:

options.series[1].dataLabels.color = 'green'

Where

[1] refers to the series that is desired to change, starting from 0.
'green' is a color, can also be hex, e.g., '#fafafa'

1 Like

Thank you! We’ll add this if we get stuck

Hi Martin,
I narrowed down when we start to lose control over Data Label settings. If there’s any custom coded added around data labels, the Data Label settings get ignored under Basic and Advanced.
We use this code to create Data Label outlines that match the color of the bars they’re on:

options.series.forEach((s, i) => {
	s.dataLabels = {
		style: {
			textOutline: options.colors[i],
			strokeWidth: 2
		},
	};
})

Is there a way to prevent this code from interrupting the Basic/Advanced settings? Or do we need to remove it?

Hi,

The code must unfortunately be removed.

Let me discuss internally what we can do to resolve this issue more generally.

1 Like