emn178/angular2-chartjs

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

Please refer to this.
See section Parent interacts with child via a local variable and Parent calls a ViewChild.

Could you please provide an example? I still don't understand how to apply prototype methods.

From one of the other issues:

You should use ChartComponent


import { ChartComponent } from 'angular2-chartjs';

//...

@ViewChild(ChartComponent) chart: ChartComponent; 

//...

this.chart.chart.update();

But this doesn't work when you have two charts on the same page.

@maikeldotuk Sure, in case of multiple components @ViewChildren() should be used. See https://angular.io/api/core/ViewChildren