Home Forums Chart Support Trigger reset zooming on wheel zooming

Trigger reset zooming on wheel zooming

Viewing 4 posts - 1 through 4 (of 4 total)
  • #34205

    Following up on this https://canvasjs.com/forums/topic/method-call-for-zoom-pan-function-in-canvas-js/

    Clicking reset button does nothing. Is there a way to programatically trigger reset of the wheel zooming?

    #34224

    @myezasifiso,

    You can reset the chart range programmatically by setting the viewportMinimum and viewportMaximum of x-axis to null inside the rangeChanged event handler as shown in the code snippet below –

    rangeChanged: function(e) {
      if(e.trigger === "reset"){
        e.chart.options.axisX[0].viewportMinimum = null;
        e.chart.options.axisX[0].viewportMaximum = null;
        e.chart.render();
      }
    },

    Please take a look at this JSFiddle for complete working code.

    Resetting zoom on click of reset button

    ___________
    Indranil Deo
    Team CanvasJS

    #34227

    Hi @Indranil Doe

    Thank you for the reply and the hints.
    FYI: As this is developed using react, we needed a way to add and remove event listener, we finally used a useCallBack hook to always point to the original event handler.

    All works fine now.

    But! we also want to move the zoom port/area left and right as you would on the normal zooming but it get stuck. You can see on your example as well if you zoom, and try to move the zoomed area left and right it does nothing.

    Can you give pointers to this.

    #34229

    Ow, sometimes it moves :-(,

    But ultimately we want to be able to control the pan programatically.

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

You must be logged in to reply to this topic.