Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Once you have added the scripts: <script src="path/to/chartjs/dist/chart.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8hammerjs@2.0.8"></script>...
Answer
#3: Post edited
- Once you have added the scripts:
- ```
- <script src="path/to/chartjs/dist/chart.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8hammerjs@2.0.8"></script>
- <script src="path/to/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.min.js"/>
- ```
- The `chartjs-plugin-zoom.min.js` can be directly enabled in charts options.
- ```
- new Chart(ctx, {
- ...
- options:{
- plugins:{
- zoom:{.../* your zoom config */ }
- }
- }
- ```
Also, according to docs, you will need to use [plugin options](https://www.chartjs.org/docs/latest/developers/plugins.html#plugin-options)
- Once you have added the scripts:
- ```
- <script src="path/to/chartjs/dist/chart.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8hammerjs@2.0.8"></script>
- <script src="path/to/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.min.js"/>
- ```
- The `chartjs-plugin-zoom.min.js` can be directly enabled in charts options.
- ```
- new Chart(ctx, {
- ...
- options:{
- plugins:{
- zoom:{.../* your zoom config */ }
- }
- }
- ```
- Also, according to docs, you will need to use [plugin options](https://www.chartjs.org/docs/latest/developers/plugins.html#plugin-options). There are also samples in the [github repo](https://github.com/chartjs/chartjs-plugin-zoom/blob/master/samples/zoom-separately.html)
#2: Post edited
- Once you have added the scripts:
- ```
- <script src="path/to/chartjs/dist/chart.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8hammerjs@2.0.8"></script>
- <script src="path/to/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.min.js"/>
- ```
- The `chartjs-plugin-zoom.min.js` can be directly enabled in charts options.
- ```
- new Chart(ctx, {
- ...
- options:{
- plugins:{
- zoom:{.../* your zoom config */ }
- }
- }
- ```
Also, according to [Charts docs](https://www.chartjs.org/docs/latest/developers/plugins.html#using-plugins), charts v3 onwards do not use `plugins` and you will need to use [plugin options](https://www.chartjs.org/docs/latest/developers/plugins.html#plugin-options)
- Once you have added the scripts:
- ```
- <script src="path/to/chartjs/dist/chart.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8hammerjs@2.0.8"></script>
- <script src="path/to/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.min.js"/>
- ```
- The `chartjs-plugin-zoom.min.js` can be directly enabled in charts options.
- ```
- new Chart(ctx, {
- ...
- options:{
- plugins:{
- zoom:{.../* your zoom config */ }
- }
- }
- ```
- Also, according to docs, you will need to use [plugin options](https://www.chartjs.org/docs/latest/developers/plugins.html#plugin-options)
#1: Initial revision
Once you have added the scripts: ``` <script src="path/to/chartjs/dist/chart.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8hammerjs@2.0.8"></script> <script src="path/to/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.min.js"/> ``` The `chartjs-plugin-zoom.min.js` can be directly enabled in charts options. ``` new Chart(ctx, { ... options:{ plugins:{ zoom:{.../* your zoom config */ } } } ``` Also, according to [Charts docs](https://www.chartjs.org/docs/latest/developers/plugins.html#using-plugins), charts v3 onwards do not use `plugins` and you will need to use [plugin options](https://www.chartjs.org/docs/latest/developers/plugins.html#plugin-options)