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.
Asked
Active
Viewed 86 times
2 Answers
2
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/

Alex KeySmith
- 16,657
- 11
- 74
- 152
-
Thanks @Alex Key for your answer is there any simple example so that i can refer it. – Mayur Sep 18 '14 at 09:00
-
No worries @Mayur I've added an example of the client-side, but I've not come across (yet) a complete client side example. – Alex KeySmith Sep 18 '14 at 10:10
0
See this question I don't think you can export the chart but you can try exporting the chart data.