HighCharts: Color of label according to the color

2019-06-17 06:23发布

问题:

Title of this questions says everything. I only found out how to change the color of connectors. If I delete the color: option, they´re all grey. I tried to put in the field with stored colors in hex, with no result, stayed black.

回答1:

In dataLabels.formatter you have access to this.point.color. So simple set useHTML: true for dataLabels, and create spans with specified colors.



回答2:

the formatter function gives you a callback object, which has a color property that can be set with the color of your choice

formatter: (format) ->
  format.color = @point.color