So I know how to change the color of x-axis labels in Highchart, which is described here.
But what if I want to change the color of just ONE label, not all the labels? How do I apply style to individual labels?
So I know how to change the color of x-axis labels in Highchart, which is described here.
But what if I want to change the color of just ONE label, not all the labels? How do I apply style to individual labels?
I am using dataLabels in a doughnut pie chart. I wanted to change the label text colors for individual pie slices, based on conditional logic, comparing values.
Just sharing because my search brought me here.
You can also use the label-formatter to set the style. Full example on jsfiddle:
I understood that you want to change the color for a specific item inside the x-axis.
I looked at the API but i didn't found an easy way to do it.
Since you can set a callback for the "chart ready event":
You can do it in a dirty way:
Hope this helps you
Note that when you use the highcharts exporting server at exporting.highcharts.com to render images for your graphs, javascript formatters will not be executed.
Fortunately highcharts translates some html tags and style attributes of individual label and title strings into equivalent SVG styling, but it is quite finicky about how it parses the html. It will strip tags that are using single quoted attributes, you need to use double quotes. Also, nesting a
<br/>
tag inside another tag will not work.So if you want two lines of text colored red for example, you get: