Home › forums › Using CanvasJS › Programmatically panning chart while zoomed in
Tagged: Pan, zoom
This topic contains 1 reply, has 2 voices, and was last updated by Vishwas R 2 weeks, 5 days ago.
Can I programmatically pan the chart when the user has zoomed into a segment of the graph?
I want to set it so if the user is panned to the latest part of the graph and then another data element gets added to the graph, that the viewport window automatically pans rightward.
You can programmatically zoom / pan to a region by setting viewportMinimum and viewportMaximum. In your case, you can set viewportMaximum to null (which resets the viewportMaximum) when user has zoomed / panned towards the latest dataPoint (latest part of the chart) using rangeChanged event. Please take a look at this JSFiddle.
You must be logged in to reply to this topic.