0👍
Once you have this:
var ctx = document.getElementById("canvas_barchart");
…and you’ve then drawn your bar chart, you can do something like this:
var context = ctx.getContext('2d');
var pixels = context.getImageData(0, 0, ctx,width, ctx.height).data;
At that point you have an array of bytes representing your image. See https://www.w3schools.com/tags/canvas_getimagedata.asp to get an idea of how that byte array is structured.
Edit: This gives more detail on how the image data is structured: https://developer.mozilla.org/en-US/docs/Web/API/ImageData
- Chartjs-Specifying the legendTemplate in Chart.js when using asp (classic)
- Chartjs-The chart doesn't display the data from my call to the API with Axios
Source:stackexchange.com