I've created circle pack chart using D3js version 3 and following is the snapshot of the chart.
I'm trying to export it using html2canvas using following code:
html2canvas(document.getElementById("chart"), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
Here, chart is the id of div element that holds the chart svg which I'm trying to export as png. The above code works fine and successfully returns the png image but the alignment and font setting of the text which is inside the svg changes as in following snapshot.
Can anyone please suggest me how can I export chart image as png with the same text settings.
Please also note that I've used the following js files for this.
Thanks in advance.
Bhagyesh
You're probably setting styles in css which htm2canvas doesn't have access to and therefore doesn't apply. If you set everything as attributes of the svg instead, it should work.