Sets the rangeChanged event handler for Chart which is triggered after viewportMinimum or viewportMaximum are updated while zooming, panning, or reset. Upon event, a parameter that contains event related data is sent to the assigned event handler. Parameter includes trigger, type and axes viewportMinimum and viewportMaximum corresponding to the event.
var chart = new CanvasJS.Chart("container", { . . zoomEnabled: true, . rangeChanged: function(e){ console.log("type : " + e.type + ", trigger : " + e.trigger + ", AxisX viewportMininum : " + e.axisX[0].viewportMinimum + ", AxisX viewportMaximum : " + e.axisX[0].viewportMaximum); }, . . . }); chart.render();
e:{ type, // event type - "rangeChaning" or "rangeChanged" trigger, // "zoom", "pan", "reset" chart, axisX:[{ // retuned only if axisX is present viewportMinimum, //null for zoomType: "y" viewportMaximum }, . . ], axisY:[{ // retuned only if axisY is present viewportMinimum, //null for zoomType: "x" viewportMaximum }, . . ], axisX2:[{ // retuned only if axisX2 is present viewportMinimum, //null for zoomType: "y" viewportMaximum }, . . ], axisY2:[{ // retuned only if axisY2 is present viewportMinimum, //null for zoomType: "x" viewportMaximum }, . . ] }
Also See: