Home › forums › Chart Support › How to disable one line in a multiline line chart › Reply To: How to disable one line in a multiline line chart
I’m so dumb, I figured it out. To do this, just set the visibility to false for the line you want hidden, like this:
visible: false,
Then, setup a click event handler so you can turn the line ‘on’ when it’s clicked in the legend.
legend: { cursor: "pointer", itemclick: function (e) { //console.log("legend click: " + e.dataPointIndex); //console.log(e); if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { e.dataSeries.visible = false; } else { e.dataSeries.visible = true; } e.chart.render(); } },
References:
visible
Hide Unhide Data Series on Legend Click