Closed DanaEpp closed 6 years ago
Find a place that it should run only once. eg app.moudle. and then
import 'chart.js'
declare var Chart;
Chart.pluginService.register(...)
How do I feed that into ChartModule for use later though? Or are you saying that it will honor that somehow?
Are you saying to create a constructor in AppModule, register the custom drawing there and ChartModule will pick that up later?
Anyone else have any feedback for this?
Thanks for this emn178. I was able to get this working. Much appreciated!
First off, let me start by saying thank you for an awesome module for Angular. Wrapping chart.js like this is awesome. Thank you!
Now onto business. I am trying to override the drawing in Chart.js according to some comments found here to add values in the middle of a doughnut chart.
So In my html for my component I have something like this:
In my TypeScript, I have this for imports:
I setup a var as such:
In ngAfterViewInit, I have something like this:
However, the property of 'register' is always undefined. I thought I had to wait until after viewInit to get a proper handle to the chart... but it seems the register isn't there.
What is the right way to do this? What am I missing?