Last Updated: February 25, 2016
· darkelda

Open Google Chart V3 in a new window as an image

I use jQuery to do the job:

Import CanVG librairies:

After creating an empty canvas and a button, you just have to catch the event (click) to execute this function:

    canvg(document.getElementById('chart_div_canvas'), jQuery('#chart_div div div').html());
    var canvas = document.getElementById('chart_div_canvas');
    var img = canvas.toDataURL("image/png");;

More information:

1 Response
Add your response

great post! i'm new to this and receive
"TypeError: target.getContext is not a function
var ctx = target.getContext('2d');"
"TypeError: target.childNodes is undefined
if (!(target.childNodes.length == 1 && target.childNodes[0].nodeName == 'OBJECT'..."
with latest canvg.

Nevertheless it works when using canvg() parameterless :)

over 1 year ago ·