I'm new to the Stackoverflow and new to the programming..
In my project we are generating diff charts dynamically..
My requirement is adding a exporting as jpeg functionality for the gauge charts.. As part of my project we have added download button for dynamically generated each chart.when user click on the download button it is showing JPEG IMAGE ICON, and when user clicks on that JPEG IMAGE ICON, Image has to download..
MY chart code is:
<div id="podContent_0" class="widget-body chart">
<div id="gaugeCount_0" align="center" style="overflow: hidden;">
<div id="glossyGauge0" style="float: left;padding-right: 5px;" widgetid="glossyGauge0">
<div class="dojoxGaugeContent" style="width: 150px; height: 150px;">
<svg overflow="hidden" width="150" height="150">
........
........
</svg>
</div>
</div>
<div id="glossyGauge1" style="float: left;padding-right: 5px;" widgetid="glossyGauge1">
<div class="dojoxGaugeContent" style="width: 150px; height: 150px;">
<svg overflow="hidden" width="150" height="150">
........
........
</svg>
</div>
</div>
<div id="glossyGauge2" style="float: left;padding-right: 5px;" widgetid="glossyGauge2">
<div class="dojoxGaugeContent" style="width: 150px; height: 150px;">
<svg overflow="hidden" width="150" height="150">
........
........
</svg>
</div>
</div>
</div>
</div>
So My chart code contains svg tags. im new to this SVG..
I have used canvg for this functionality
But getting error like : ERROR: Element 'parsererror' not yet implemented. canvg.js:2619
My code Is:
I created a canvas
<canvas id="myCanvas" width="400px" height="200px"></canvas>
and
var svg = document.getElementById('#podContent_'+i).innerHTML.trim();
var canvas = document.getElementById("myCanvas");
canvg(canvas, svg, { renderCallback: function () {
var img = canvas.toDataURL("image/png");
window.open(img);
});
But finally i'm getting a BLANK IMAGE with error saying:
ERROR: Element 'parsererror' not yet implemented. canvg.js:2619
Please Anyone help me.....
Thanks in advance........