Home Forums Chart Support Toggle Pan/Zoom in react

Toggle Pan/Zoom in react

Viewing 3 posts - 1 through 3 (of 3 total)
  • #26765

    Hello there,

    I have a react app with a CanvasJs chart and I would like to switch between pan and zoom using a react component rather than the default ui menu.

    I was previously using the dirty little hack:

    $('.canvasjs-chart-toolbar button:eq(0)').click();

    because I don’t think you expose the required method to toggle the chart interaction state.

    So What’s the best way to trigger this from a react app? still trigger a click event?

    #26766

    resorting to document.querySelectorAll('.canvasjs-chart-toolbar button')[0].click()

    but would prefer to trigger the event directly if possible.

    #26772

    @offwhtie,

    Sorry, it’s not possible to switch to pan mode by default as of now. However you can perform a click programmatically to achieve – as you have mentioned. Please take a look at this JSFiddle.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.