Chartjs-Ng2 ChartData filled with observable

0👍

You can cast a string to a number (assuming its actually a number) using parseInt(value, base) so in your case it would look something like

public ChartData: ChartDataSets [] = [
  {data: [], label: 'Average'},
];
this.tasks.pipe(
  map(x => x.map(x => parseInt(x.name, 10)))
).subscribe((result => this.ChartData.data = result));

Leave a comment