Well, I guess I did it.
It took me long time to find out that the preventDefault() doesn't work well with the linkedTo mechanism. Don't know if this is a bug or not, but showing the parent after hiding always shows
all linked child series, regardless the preventDefault.
I found another way by combining your strategy with the flag and pushing values to an array. As far as I know it works OK, but only when you hide all series from one sort, you have to reload. And I don't like this piece of code, but for now it works. Target is to push unique values to an array from a forEach loop.
Code: Select all
chart.series.forEach(s => {
if (s.userOptions.stack && s.visible) {
names.push(s.name)
}
})
uniq = [...new Set(names)];
console.log(uniq)
It can probably be written in two lines or so, but my JS knowledge is simply not good enough. Only issue open is when hiding all series, I hope to fix that in some time.
I hope that others can use this example.. That is why I keep posting.
Link to the fiddle:
http://jsfiddle.net/6n94x0wv/7/