call Chart.js methods
d668 opened this issue · 5 comments
d668 commented
In the doc you are saying:
Chart instance. You can call Chart.js methods via this member.
What this supposed to mean? There is no chartComponent
available
emn178 commented
Please refer to this.
See section Parent interacts with child via a local variable
and Parent calls a ViewChild
.
mgween commented
Could you please provide an example? I still don't understand how to apply prototype methods.
colmben commented
From one of the other issues:
You should use ChartComponent
import { ChartComponent } from 'angular2-chartjs';
//...
@ViewChild(ChartComponent) chart: ChartComponent;
//...
this.chart.chart.update();
maikelthedev commented
But this doesn't work when you have two charts on the same page.
apostnov commented
@maikeldotuk Sure, in case of multiple components @ViewChildren() should be used. See https://angular.io/api/core/ViewChildren