You must be logged in to post your query.
Home › Forums › Chart Support › toggle legend crash with axisX2
Tagged: toggle legend crash with axisX2
hi, I met an issue :
setting axisX2 with 4 attributes, minimum, maximum, interval, intervalType with x of Date, it crash the CanvasJS when we try to re-render the chart as user click the legend to toggle visibility. Please help.
here is jsfiddle : https://jsfiddle.net/a0pu5tLe/
@samuel-cheng,
It seems like issue is happening when you are setting interval on datetime axis and none of the dataseries is visible. To overcome this issue, you can unset the interval when the dataseries is not visible and vice-vera when dataseries is visible as shown in the below code snippet.
itemclick: function (e) { if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { e.chart.options.axisX2.interval = undefined; e.dataSeries.visible = false; } else { e.chart.options.axisX2.interval = 3; e.dataSeries.visible = true; } e.chart.render(); }
Also, check out this updated JSFiddle for complete working code.
—- Manoj Mohan Team CanvasJS
You must be logged in to reply to this topic. Login/Register