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));
- Chartjs-How to differentiate the data of one topic or another coming from Mercure hub if the client is suscribed to two topics
- Chartjs-How to address type errors when removing data with chart.js?
Source:stackexchange.com