Question

I have generated four charts on the html page using amchart in 4 divs respectively. On each div there is a link for export the chart. The charts are generated using multiple SVG. I want to save the chart separately as an image on client side by clicking the export link.

Finally, I got my solution. I convert all the svg to image one by one and write it in a div using http://www.battlehorse.net/page/topics/charts/save_google_charts_as_image.html

And finally I convert the div content to image using http://html2canvas.hertzen.com/index.html. If any one want to convert the text and svg then you need to clone the div content to the new div and then write the converted image to new div and finally convert it to image.

Was it helpful?

Solution

If you could draw the chart on a canvas you could save that. Just saving a div and it's contents to an image is hard (I don't think it's even possible)...

Your question is related to this. It might help.

EDIT

If you are using amchart, it is creating an svg. You can create an hidden canvas, draw the svg onto the canvas, save it as a data url, present it as a jpg/png/.. to the users. (more info)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top