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