Home Forums Chart Support Reset button

Reset button

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

    I want the reset functionality in a custom button click.
    document.getElementsByClassName(‘canvasjs-chart-toolbar’)[0].children[1].click()

    The above solution works only for the first time . But, if you want to Zoom-in and reset it again it does not work.

    #35116

    @malvika,

    You can reset the axis range programmatically by setting viewportMinimum & viewportMaximum to null. Please refer to the code-snippet below which shows how to reset the axis range on button click.

    document.getElementById("resetChart").addEventListener("click", function() {
      chart.axisX[0].set("viewportMinimum", null, false);
      chart.axisX[0].set("viewportMaximum", null);
    });

    Please take a look at this JSFiddle for complete code.
    Reset Axis Range Programmatically


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.