Home › forums › Using CanvasJS › Button to zoom › Reply To: Button to zoom
When you change the viewport range by either zooming, panning or reset rangeChanging and rangeChanged events are fired. rangeChanging event is fired just before the current viewports are updated and the rangeChanged is fired on updation of the current viewports i.e. after zooming, panning or reset. An event parameter is passed to the event handler that you assign to the rangeChanging/rangeChanged event.This parameter contains current viewportMinimum, viewportMaximum and other properties.
You can use the viewportMinimum and viewportMaximum to check in which range of the axis you have zoomed into.
Please have a look at this jsfiddle in which all the dataPoints in the current zoomed range is displayed in the browser console.
Also please refer the following jsfiddle which shows the viewports on zooming/panning.