My question is exactly the same as the OP in this question:
Set Additional Data to highcharts series
But the accepted answer explains how to add additional data to the point, not the series, without saying if it's possible to do with the series or not.
I would like to be able to define a series like:
series: [
{"hasCustomFlag": true, "name": "s1", "data": [...]},
{"hasCustomFlag": false, "name": "s2", "data": [...]},
]
and be able to use point.series.hasCustomFlag
inside of a formatting function. Is this possible?
I don't want to put the data on the point level, because that means I'd have to duplicate the data far too many times.
Yes this is possible, the extra configuration properties is located under the options
property (this.series
refers to the series instance, not the configuration objects). See the reference here and scroll down to properties section.
So instead use this line in the formatter:
if (this.series.options.hasCustomFlag) { ... }
Full example on jsfiddle
This appears to have been revised with later iterations of HighCharts/HighStocks. The jsfiddle example no longer works. Using the "this.series.options.hasCustomFlag" syntax results in "undefined". The debugger shows the data I'm looking for is in "this.series.userOptions.data" - an unsorted very large array, but the entire series is there - not the specific record data you normally get with this.x or this.y.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With