Reputation: 806
How can I save a Chart Wrapper to an image (png, jpg, bmp ... i don't care) at a click of a button.
A normal google chart is not a problem, you just need to right click on it and save as image.
But how would you save an image of a chart in a Google Chart Wrapper???
Upvotes: 0
Views: 1049
Reputation: 2800
I think the relevant documentation you're looking for is on the Charts API Website. This method will display the chart as a PNG formatted image instead of SVG. You will lose your interactive features like tooltips and selections.
If you still want those features you could write a link that pops the static chart image into a new window to be saved.
Since you're using a ChartWrapper
you will need to use something like:
var imageUri = chartWrapper.getChart().getImageURI();
The Uri it returns is a base64-encoded PNG image, which most modern browsers will render as an image if used as the src
attribute for an img
tag, or just entered directly into the address bar.
Upvotes: 2