How start with a hidden serie on graph and then display it with a custom legend button like
<div>
<input type="button" value="hide show NAME_OF_THE_SERIE" id="buttonid">
</div>
<script>
button = document.body.querySelector('#buttonid');
button.addEventListener('click', (e) => {
myChart.dispatchAction({
type: "legendToggleSelect",
name: "NAME_OF_THE_SERIE"
});
console.log(myChart.getOption().series);
});
</script>
Here the link of the codepen.io where I took this
Now, like you see in console (if you implement this method) the object with the serie name “NAME_OF_THE_SERIE” returned with chart.getOption().series
it’s exactly the same when the serie is hidden and when it’s showed on graph.
So also how to know if a serie it’s hidden?