vimalavinisha / angular2-google-chart

Angular 2 google chart
MIT License
59 stars 45 forks source link

Refresh on data change #27

Open Kishore2Learn opened 7 years ago

Kishore2Learn commented 7 years ago

Chart was not refreshing wen data changes. I handled ngOnChanges event and it worked. ngOnChanges(){ if(!googleLoaded) { googleLoaded = true; google.charts.load('current', {'packages':['corechart', 'gauge']}); } setTimeout(() =>this.drawGraph(this.chartOptions,this.chartType,this.chartData,this._element),1000); }

Bogdan-Kalynovskyi commented 7 years ago

+1

liquidpizza commented 7 years ago

I just added ngOnChanges(changes) { if (googleLoaded) { this.drawGraph(this.chartOptions,this.chartType,this.chartData,this._element); } } in angular2-google/directives/angular2-google-chart.directive.ts and imorted OnChanges. Works fine too. Can someone include this in the code?

vimalaanthony commented 7 years ago

I will do soon. Thanks

vimalaanthony commented 7 years ago

Hi I have updated the above request