开发者

Is there any way to save the contents (say a graph) of a particular div tag in a browser webpage as an image using javascript?

I am creating an ASP.NET web application. In one o开发者_StackOverflow中文版f my webpages (an ASCX control) I am placing a fusion chart inside a <div> tag. I want to provide an option for the client to download this fusion chart.

Is there any way that I can download the fusion chart present in the Div tag, as an image (Using javascript because the div tag is a client side control).

The request is that my client could save this fusion chart present in the <div> tag as an image when he visits the webpage.

The target browser is IE.

Please help me.


I can confirm that it is not possible to 'Export the chart as image' when using FusionCharts Free. However, as mentioned by Larsenal, you will be able to use FusionCharts v3.2.1 and it's updated JavaScript API to export pure JavaScript charts to JPEG, PNG, PDF, SVG formats. Ref.- http://www.fusioncharts.com/docs/?ECPureJS.html

Furthermore, you may even export your Flash charts, if required, in a similar manner. DO check out the link below for a more detailed account of the same. Ref.- http://www.fusioncharts.com/docs/?ECOverview.html

Hope this helps.


It is currently not possible to generate an image from a section of a webpage with JavaScript. Quoting myself from another question:

Firefox added something similar to this to their canvas implementation. You can find CanvasRenderingContext2D.drawWindow() documented in their wiki. It is restricted to being used by plugins, for security purposes, and isn't supported by any other browsers.

There is talk of adding support to other browsers, and perhaps removing some of the security restrictions, but that is probably a long way off. For now, there isn't a good JavaScript solution to your problem.


Sorry, there's no way to do it with Javascript.

I don't know about the Fusion controls, but some graphing libraries include a way to render to an image or PDF. Start looking there, not Javascript.

Update: FusionCharts claims to have the ability to export to JPG, PNG, PDF and CSV. Start with this page about exporting pure JS charts in their documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜