Interesting. I just looked around a bit and I can't seem to find any way currently to dynamically ask the core Highcharts library for the color of a series in a custom tooltip formatter. (If anyone is aware of a way to do this though, please feel free to correct me!)
So, what you may want to do is set the color of the series on your own so that you know which color each series in when you go to create the custom tool tip. E.g.
Note that the default series colors which come with Highcharts are: "#4572A7", "#AA4643", "#89A54E", "#80699B", "#3D96AE", "#DB843D", "#92A8CD", "#A47D7C", and "#B5CA92"
Hope that helps...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Internally Highcharts parses the HTML you return from the tooltip formatter and attempts to convert it to SVG. So, only a subset of HTML is supported. There is a bit of discussion about this in the JavaDoc for the ToolTipFormatter class, but the portion that is most relevant to this question is the following:
"A subset of HTML is supported. The HTML of the tooltip is
parsed and converted to SVG, therefore this isn't a complete
HTML renderer. The following tags are supported: <b>, <strong>,
<i>, <em>, <br/>, and <span>. Spans can be styled with a
style attribute, but only text-related CSS that is shared
with SVG is handled."
Interesting. I just looked around a bit and I can't seem to find any way currently to dynamically ask the core Highcharts library for the color of a series in a custom tooltip formatter. (If anyone is aware of a way to do this though, please feel free to correct me!)
So, what you may want to do is set the color of the series on your own so that you know which color each series in when you go to create the custom tool tip. E.g.
Note that the default series colors which come with Highcharts are: "#4572A7", "#AA4643", "#89A54E", "#80699B", "#3D96AE", "#DB843D", "#92A8CD", "#A47D7C", and "#B5CA92"
Hope that helps...
Internally Highcharts parses the HTML you return from the tooltip formatter and attempts to convert it to SVG. So, only a subset of HTML is supported. There is a bit of discussion about this in the JavaDoc for the ToolTipFormatter class, but the portion that is most relevant to this question is the following:
You can find some more detail about this in the core Highcharts documentation reference as well.
Hope that helps,
-Shawn