We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Export chart as an image

Saw that you could export the chart as an image in JS.
Is that possible in Lightswitch html?

If yes, do you have an example?


1 Reply

PR Praveen Syncfusion Team April 13, 2015 08:55 AM UTC

Hi Sven,
Thanks for using Syncfusion product. We have analyzed this. Exporting a chart is possible in LightSwitch html. To export a chart, it should be rendered as HTML5 canvas element. This can be achieved by setting the below property in sample
enableCanvasRendering: true,

By default chart is rendered as SVG element. On specifying this property it is rendered as HTML5 canvas. Then this can be converted as an image and saved to disk locally by specifying the below code.
function download() { // triggered on clicking the export link/button
var canvas = $("#container").ejChart("exportChart"); // to get the chart rendered
var dt = canvas.toDataURL('image/png'); // to convert it as an image
this.rel='nofollow' href = dt.replace(/^data:image\/[^;]/, 'data:application/octet-stream'); // to download that image

We have also made a sample to illustrate this. Kindly find it from the below location.


And in addition exporting LightSwitch HTML chart is not possible in Internet Explorer browser. Because popup/client side downloading is blocked for security purpose in IE. So you have manually right click on the rendered chart and save it as image.

Please let us know if you have any concern.


Live Chat Icon For mobile
Up arrow icon