Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use plugins in ng2-charts?

I'm not sure how exactly to import a plugin into ng2-charts, specifically the annotation plugin. I'm using Angular2 / Ionic2. There doesn't seem to be any documentation or answers on this.

like image 843
Daniel Engle Avatar asked Jan 25 '17 23:01

Daniel Engle


1 Answers

I would avoid to declare Chart like this. Instead you can do import {Chart} from 'chart.js' since it is a subdependency of ng2-charts anyway.

By this approach your IDE can still do autocompletion and you are not telling angular to just believe that there is something called Chart.

To be consistent you should also add it to your package.json.

like image 148
Paquan Avatar answered Sep 27 '22 17:09

Paquan