I am having a challenge trying to create a graph for each mat-card in a *ngFor loop. I am setting the canvas like this:
<canvas id="coinLineChart{{coin_index}}" width="200" height="150"></canvas>
then create a variable of the id value like this:
let chart_id = `coinLineChart` + `${this.coin_index}`.
Then I tried to get the ctx value like this:
coinLineChart = document.getElementById(chart_id);
const ctx = coinLineChart.getContext("2d");
but coinlLineChart turns out to be null. Can anyone suggest a way to do this? I am using chartjs v3 with Angular 13