Home › forums › Chart Support › Toggle Pan/Zoom in react
Tagged: react pan zoom
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:
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?
resorting to document.querySelectorAll('.canvasjs-chart-toolbar button').click()
but would prefer to trigger the event directly if possible.
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.
You must be logged in to reply to this topic.