Home Forums Chart Support toggle legend crash with axisX2

toggle legend crash with axisX2

Viewing 2 posts - 1 through 2 (of 2 total)
  • #39048

    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/

    #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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.