简体   繁体   中英

Is it possible to get D3js charts into xml?

I have created a simple Area chart from D3js Example. Now i want to export complete code of area chart into xml so that any end user can manually change xml data and then save it and use it. Is there a way to achieve in it.

If you are generating SVG via D3.js, it is naturally XML - which is handy for you.

You could grab the SVG from the HTML DOM and use the FileSaver API to generate a file to save.

Here is a FileSaver polyfil which also has a nice introduction .

Alternatively you could send the SVG (from the DOM) via Ajax and do it server-side.

UPDATE:

Here is an example of grabbing the svg element on the client side, however it generates the download vis the server-side. Mixed with FileSaver you could do the lot client side. http://d3export.housegordon.org/

看到这个问题,我认为您无法导出图表,但可以尝试导出图表数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM