[Chartjs]-Chart.js error: type lacks a call signature '((…items: number[]) => number) | ((…items: ChartPoint[]) => number)' in Angular

6👍

Actually [datasets]="lineChartData" has two types. One is number[] and other is ChartPoint[] so to store data as number we need to type-cast data as

(this.lineChartData[0].data as number[]).push(1)

HTML

<div style="display: block;">
    <canvas #myChart baseChart [datasets]="lineChartData"></canvas>
</div>

Leave a comment