Reputation: 566
I use CanvasJS in my project and it worked fine until now.
Here is the two examples from the web site :
Hide Unhide Data Series on Legend Click
Since i added the option maximum:
to my Axis Y2-2 var the scale no longer hides by clicking in the legend !
Here is my JSfiddle live example
Can you help me to debug it please ?
Upvotes: 0
Views: 813
Reputation: 566
Well, I solved this issue and here an workable example jsfiddle.
if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
if (e.dataSeriesIndex == 2) {
e.chart.options.axisY2[0].valueFormatString = " ";
e.chart.options.axisY2[0].title = null;
e.chart.options.axisY2[0].lineColor = "#BBBBBB";
};
}
else {
e.dataSeries.visible = true;
if (e.dataSeriesIndex == 2) {
e.chart.options.axisY2[0].valueFormatString = "#,##0.##";
e.chart.options.axisY2[0].title = "Linear Scale";
e.chart.options.axisY2[0].lineColor = "#7F6084";
};
}
I hope that can help someone else :)
Upvotes: 1