1👍
I did a little bit different. Instead of creating the canvas tag inside a *ngFor
, I created the chart canvas dynamically at the component code.
const wrapper = document.getElementById('chart-wrapper');
const newCanvas = document.createElement('canvas');
newCanvas.id = metric.canvas;
wrapper.appendChild(newCanvas);
const ctx = (newCanvas as HTMLCanvasElement).getContext('2d');
this.lineChart = new Chart(ctx, chartOptions);
Source:stackexchange.com