In order to save a chart as an image, you need a few things:
1. Include these two script links in your HTML, before the javascript for your charts:
function getImgData(chartContainer) { var chartArea = chartContainer.getElementsByTagName('svg')[0].parentNode; var svg = chartArea.innerHTML; var doc = chartContainer.ownerDocument; var canvas = doc.createElement('canvas'); canvas.setAttribute('width', chartArea.offsetWidth); canvas.setAttribute('height', chartArea.offsetHeight); canvas.setAttribute('style', 'position: absolute; ' + 'top: ' + (-chartArea.offsetHeight * 2) + 'px;' + 'left: ' + (-chartArea.offsetWidth * 2) + 'px;'); doc.body.appendChild(canvas); canvg(canvas, svg); var imgData = canvas.toDataURL('image/png'); canvas.parentNode.removeChild(canvas); return imgData;}function saveAsImg(chartContainer) { var imgData = getImgData(chartContainer); // Replacing the mime-type will force the browser to trigger a download // rather than displaying the image in the browser window. window.location = imgData.replace('image/png', 'image/octet-stream');}(functions taken from
https://gist.github.com/1333906 and converted for the current API by forum user trybka)
To save a chart as an image, call the saveAsImg function, passing it the container div of the chart you want to save. So, if your chart is in "chart_div", then you save it as an image with this call:
saveAsImg(document.getElementById('map_div'));
You can call that for each chart to save them individually, and then import them into your PDF. Note that a) this only works in modern browsers (no IE 8 and earlier), and b) you will probably have to rename the file with a .png extension once it has downloaded.