angular - ng2-charts empty initial dataset -


i experimenting ng2-charts using angular 2. started following example create line chart. initialises chart using dataset follows:

  public linechartdata:array<any> = [     {data: [65, 59, 80, 81, 56, 55, 40], label: 'series a'},     {data: [28, 48, 40, 19, 86, 27, 90], label: 'series b'},     {data: [18, 48, 77, 9, 100, 27, 40], label: 'series c'}   ]; 

i want progess retrieving data server - works, no longer want hardcoded initial dataset. if change linechartdata empty, following error:

error error: ng-charts configuration error,       data or datasets field required render char line stack trace: ../../../../ng2-charts/charts/charts.js/basechartdirective.prototype.getdatasets@http://localhost:4200/vendor.bundle.js:31447:19 ../../../../ng2-charts/charts/charts.js/basechartdirective.prototype.getchartbuilder@http://localhost:4200/vendor.bundle.js:31375:24 ../../../../ng2-charts/charts/charts.js/basechartdirective.prototype.refresh@http://localhost:4200/vendor.bundle.js:31457:22 ../../../../ng2-charts/charts/charts.js/basechartdirective.prototype.ngoninit@http://localhost:4200/vendor.bundle.js:31346:13 

the way have been able round add empty objects in linechartdata. places constraint on how data can return. currently, not sure how data needs returned, or if arbitrary.

is there way of having empty initial dataset populated when data retrieved server?


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -