Chartjs-Writing blank on canvas using fillText

2đź‘Ť

âś…

In typical use cases people don’t attempt to “undo” their changes on the Canvas – it’s far easier to just clear the Canvas and start drawing all over again.

ctx.clearRect(0, 0, canvas.width, canvas.height);
// Do my drawing again
myChart.update(); // With chart.js this triggers a redraw.

In your case I think you’re making the mistake of thinking that the Canvas saves the text image and lets you alter it in subsequent drawings. Think of it like Microsoft Paint – once that text is on the image, you’re not going to be able to get rid of it easily without undo’ing.

Leave a comment