Home › forums › Using CanvasJS › How to display Donut Chartsas a static image (png, jpg)
Tagged: Donut Chartsas, image, PNG, static image
This topic contains 1 reply, has 2 voices, and was last updated by Vishwas R 3 weeks, 6 days ago.
I’d like to display the Donut Chartsas as a static image (png, jpg, gif, etc) instead of an interactive chart. I don’t mean just turning off interactive but actually displaying it as an image, so I can use the chart on a page like as a background image or something.
How can the chart be output on the page as an image?
I searched around and couldn’t find anything. There was something here about having it fallback as a static image, but wasn’t sure what this was https://canvasjs.com/forums/topic/how-to-display-chart-as-a-static-image-png-jpg/
I tried it, but it doesn’t print the graphic
You can get base64 image of chart using toDataURL. And passing this image as image source will work in your case. Please check this JSFiddle.
If you are still facing issue, kindly create JSFiddle reproducing the same and share it with us so that we can look in to the code, understand the use-case better and help yo out.
You must be logged in to reply to this topic.