In this example we will be exporting a chart generated using the php-d3-lib.
This example uses saveSvgAsPng.js to perform the actual svg conversion. More info on saveSvgAsPng.js can be found on Github @ https://github.com/exupero/saveSvgAsPng
let showUri = function () { svgAsDataUri(d3.select('svg').node(), {}, function(uri) { console.log('uri', uri); document.getElementById("showUri").innerText = uri }); }; let saveImage = function () { saveSvgAsPng(d3.select('svg').node(), 'chart.png'); };