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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export chart as an image

Thread ID:

Created:

Updated:

Platform:

Replies:

118817 Apr 12,2015 07:21 AM UTC Apr 13,2015 08:55 AM UTC LightSwitch HTML 1
loading
Tags: Chart
Sven
Asked On April 12, 2015 07:21 AM UTC

Hi,
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?

Regards
Sven

Praveen [Syncfusion]
Replied On 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
[JS]
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.
[JS]
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.

http://www.syncfusion.com/downloads/support/directtrac/general/attachment_lighswitch-1684310230.zip

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.

Thanks,
Praveenkumar

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;