@@ -12,67 +12,69 @@ Zooming is done via the mouse wheel or via a pinch gesture. [Hammer JS](http://h
1212To configure the zoom and pan plugin, you can simply add new config options to your chart config.
1313
1414``` javascript
15- {
16- // Container for pan options
17- pan: {
18- // Boolean to enable panning
19- enabled: true ,
20-
21- // Panning directions. Remove the appropriate direction to disable
22- // Eg. 'y' would only allow panning in the y direction
23- mode: ' xy' ,
24- rangeMin: {
25- // Format of min pan range depends on scale type
26- x: null ,
27- y: null
28- },
29- rangeMax: {
30- // Format of max pan range depends on scale type
31- x: null ,
32- y: null
33- },
34- // Function called once panning is completed
35- // Useful for dynamic data loading
36- onPan : function ({chart}) { console .log (` I was panned!!!` ); }
37- },
38-
39- // Container for zoom options
15+ plugins: {
4016 zoom: {
41- // Boolean to enable zooming
42- enabled : true ,
43-
44- // Enable drag-to-zoom behavior
45- drag : true ,
46-
47- // Drag-to-zoom rectangle style can be customized
48- // drag: {
49- // borderColor: 'rgba(225,225,225,0.3)'
50- // borderWidth: 5,
51- // backgroundColor: 'rgb(225,225,225)'
52- // },
53-
54- // Zooming directions. Remove the appropriate direction to disable
55- // Eg. 'y' would only allow zooming in the y direction
56- mode : ' xy ' ,
57-
58- rangeMin : {
59- // Format of min zoom range depends on scale type
60- x : null ,
61- y : null
17+ // Container for pan options
18+ pan : {
19+ // Boolean to enable panning
20+ enabled : true ,
21+
22+ // Panning directions. Remove the appropriate direction to disable
23+ // Eg. 'y' would only allow panning in the y direction
24+ mode : ' xy ' ,
25+ rangeMin : {
26+ // Format of min pan range depends on scale type
27+ x : null ,
28+ y : null
29+ },
30+ rangeMax : {
31+ // Format of max pan range depends on scale type
32+ x : null ,
33+ y : null
34+ },
35+ // Function called once panning is completed
36+ // Useful for dynamic data loading
37+ onPan : function ({chart}) { console . log ( ` I was panned!!! ` ); }
6238 },
63- rangeMax: {
64- // Format of max zoom range depends on scale type
65- x: null ,
66- y: null
67- },
68-
69- // Speed of zoom via mouse wheel
70- // (percentage of zoom on a wheel event)
71- speed: 0.1 ,
7239
73- // Function called once zooming is completed
74- // Useful for dynamic data loading
75- onZoom : function ({chart}) { console .log (` I was zoomed!!!` ); }
40+ // Container for zoom options
41+ zoom: {
42+ // Boolean to enable zooming
43+ enabled: true ,
44+
45+ // Enable drag-to-zoom behavior
46+ drag: true ,
47+
48+ // Drag-to-zoom rectangle style can be customized
49+ // drag: {
50+ // borderColor: 'rgba(225,225,225,0.3)'
51+ // borderWidth: 5,
52+ // backgroundColor: 'rgb(225,225,225)'
53+ // },
54+
55+ // Zooming directions. Remove the appropriate direction to disable
56+ // Eg. 'y' would only allow zooming in the y direction
57+ mode: ' xy' ,
58+
59+ rangeMin: {
60+ // Format of min zoom range depends on scale type
61+ x: null ,
62+ y: null
63+ },
64+ rangeMax: {
65+ // Format of max zoom range depends on scale type
66+ x: null ,
67+ y: null
68+ },
69+
70+ // Speed of zoom via mouse wheel
71+ // (percentage of zoom on a wheel event)
72+ speed: 0.1 ,
73+
74+ // Function called once zooming is completed
75+ // Useful for dynamic data loading
76+ onZoom : function ({chart}) { console .log (` I was zoomed!!!` ); }
77+ }
7678 }
7779}
7880```
0 commit comments