Home Forums Chart Support toggle legend crash with axisX2 Reply To: toggle legend crash with axisX2

#39059

@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.

Chart with interval on Datetime X-Axis

—-
Manoj Mohan
Team CanvasJS