score:1

In the browser you can use a charting library that renders to <canvas> such as chart.js

http://www.chartjs.org

Then once you have rendered your chart on the canvas you can obtain the image data as PNG or JPG:

var canvas = document.getElementById('myCanvas');
var dataURL = canvas.toDataURL("image/png");

This will give you a base64 encoded uri of the image that you could use with an html image:

var imgElement = document.getElementById('myImg');
imgElement.src = dataURL;

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs

You can also directly get the image data from the canvas:

var imgData = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);

https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData


Related Query

More Query from same tag