Home Forums Chart Support How to display chart as a static image (png, jpg) Reply To: How to display chart as a static image (png, jpg)

#27667

@joshua,

You are getting blank image instead of pie chart in the image as you are exporting chart before animation completes. Exporting chart as image after completion of animation by adding a delay should work fine in your case. Below is the code snippet for the same.

setTimeout(function(){ 
	var base64Image = chart.canvas.toDataURL();
	document.getElementById('monImage').src = base64Image;
}, chart.get("animationDuration") + 500); //500ms extra

Please take a look at this updated JSFiddle for complete code.


Vishwas R
Team CanvasJS