Using zoom plugin for chart.js in Ionic

#1

I was trying to use the chart.js zoom plugin for my chart.js charts but I cannot seem to get it to work. I’ve installed it and have tried importing it but that didn’t work. The gitlab for the plugin says to add it to the chart.js configuration but I cannot seem to find that. Has anyone used plugins for chart.js?

1 Like
#2

Could you provide some links to the plugins you are talking about?

#3

I am using https://github.com/chartjs/chartjs-plugin-zoom but just found my issue. I needed to import the plugin to my page like this: import ‘chartjs-plugin-zoom’;

2 Likes
#4

Hey @akaraali, any chance you could post your code? I’ve been trying to get that library working in Ionic 2 but haven’t had any luck. Thanks.

#5

Nevermind @akaraali, just realised it is a bug in V2.6.0 of chart.js which broke x axis pan and zoom which was causing me the issues. I downgraded to V2.5.0 and now it’s all working.

#6

Thank you! I had a similar problem and i solved in this way!

#7

import ‘chartjs-plugin-zoom’; in app.module.ts and it works

#8

Can anyone put some sample code to implement zoom on chart options?, I add the plugin and import to the app.module.ts, but then I put in options shows me an error. cannot find name zoom