Skip to content

Commit 48a24d5

Browse files
Techn1xbenmccann
authored andcommitted
Added onPan/onZoom args (#178)
Pass chart to doPan() and doZoom()
1 parent 82a486b commit 48a24d5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To configure the zoom and pan plugin, you can simply add new config options to y
3333
},
3434
// Function called once panning is completed
3535
// Useful for dynamic data loading
36-
onPan: function() { console.log('I was panned!!!'); }
36+
onPan: function({chart}) { console.log(`I was panned!!!`); }
3737
},
3838

3939
// Container for zoom options
@@ -66,7 +66,7 @@ To configure the zoom and pan plugin, you can simply add new config options to y
6666
},
6767
// Function called once zooming is completed
6868
// Useful for dynamic data loading
69-
onZoom: function() { console.log('I was zoomed!!!'); }
69+
onZoom: function({chart}) { console.log(`I was zoomed!!!`); }
7070
}
7171
}
7272
```

src/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function doZoom(chart, percentZoomX, percentZoomY, focalPoint, whichAxes) {
200200
chart.update(0);
201201

202202
if (typeof zoomOptions.onZoom === 'function') {
203-
zoomOptions.onZoom();
203+
zoomOptions.onZoom({chart: chart});
204204
}
205205
}
206206
}
@@ -278,7 +278,7 @@ function doPan(chartInstance, deltaX, deltaY) {
278278
chartInstance.update(0);
279279

280280
if (typeof panOptions.onPan === 'function') {
281-
panOptions.onPan();
281+
panOptions.onPan({chart: chartInstance});
282282
}
283283
}
284284
}

0 commit comments

Comments
 (0)