Hi,
I am trying to export chart as an image using below code (from documentation):
var pngImage = $('chartDiv"]').igDataChart("exportImage", 200, 100);
I am just stuck here. I want a image of chart. I am not sure how to get that.
Any help would be appreciated.
Below is the code:
var pngImage = $("#mChart").igDataChart("exportImage"); var pngImageSrc = pngImage.src; pngImageSrc = pngImageSrc.replace('data:image/png;base64,', '');
Now I am passing pngImageSrc to MVC Action and converting it to byte[] and returning File object from Action.
Thanks for the link. The link shows how to get image for PHP.
Any ideas how that could be implemented in Asp.Net MVC 3.
Also see:
http://stackoverflow.com/questions/11645468/how-to-save-an-image-file-with-the-src-i-have-created-by-drawing-on-html-5-canva
-Graham
Hi, the function of that member in our api is to provide an image DOM element that you can use. There isn't a direct way to use that or the data url that is its src attribute to save to disk.
There are various people that have explained how to take a data url and save it to disk though:
http://www.nihilogic.dk/labs/canvas2image/
Essentially if you grab the src of the image that you get back from exportImage, you could feed it into the logic presented on that site and it would let you save an image to disk.
If you would like this sort of thing baked into the product, please make a feature request.
Let me know if you have any issues.
Hi Graham, Any update on this ?????