angular2-highcharts icon indicating copy to clipboard operation
angular2-highcharts copied to clipboard

Dynamic data with service rest

Open jmerazhn opened this issue 8 years ago • 6 comments

Hello people!

I would like to support myself with the following inconvenience that I have. I am trying to load the data obtained from a rest service to the options of the chart but unfortunately does not show me the chart on screen. Thank you.

Greetings.

options

jmerazhn avatar Apr 20 '17 02:04 jmerazhn

Is this.ventas the result of a callback, or the observable itself? Are you trying to achieve live update, or just load the data once?

ronnyek avatar Apr 21 '17 21:04 ronnyek

@ronnyek is the result of a callback.

data1 data2

jmerazhn avatar Apr 21 '17 21:04 jmerazhn

it won't work, only recreating component will show new data I solved it with ngIf, show the chart after data is available

KaganRoman avatar Apr 23 '17 13:04 KaganRoman

@KaganRoman could you please show some sample code with ngIf?

dgt009 avatar Apr 24 '17 06:04 dgt009

@dgt009: html: <chart [options]="chartOptions" *ngIf="showData"></chart> ts: refreshData() { this.service.getData().then(data => initChart(data)); this.showData = true; }

KaganRoman avatar Apr 24 '17 07:04 KaganRoman

Hi @KaganRoman. In effect this problem has been solved with ngif. Thank you very much.

Regards!

jmerazhn avatar Apr 24 '17 16:04 jmerazhn