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/
See this question I don't think you can export the chart but you can try exporting the chart data.
Related
I'm trying to export multiple graphs (fusion charts XT - rendered as SVG format in web page) to PDF. I learnt fusion charts isn't providing any feature for Javascript graphs. I search for multiple dlls. Finally tried working with jsPDF.js as well as svg_to_pdf.js - but when it comes to rendering multiple graphs - not sure how to proceed. Is there any example online for downloading multiple svg images in a web page to pdf? Please suggest.
Do you have multiple graphs on the same page and want to export them all into one PDF?
If yes, then you can probably consider converting those SVGs into multiple image streams (base64 encoded) using canvas, pass them to the server side, and the server can generate a PDF file containing those image streams.
We have used this method in our own application and I hope it can help you, too.
I have a web app that I'm writing with FLASK and JavaScript which allows the user to drag and drop a CSV file, the CSV file is then parsed and rendered via Highcharts -- all with JavaScript. Trouble is, the chart obviously won't save in the form.
My question is, how would I go about storing the chart that I just rendered? I'm kind of doing reverse logic here instead of feeding the data to highcharts via a db, so maybe that would be a better option?
I saved a .gml from wolfram mathimatica, does anyone have an example of how to load the file and display on a webpage? I am dealing with d3 at the moment, would another language be more appropriate?
Thanks.
There's a really good post on exactly this at one developer's blog.
The gist of it is that D3, even in its latest version (v4, at the time of writing this), can't import GML files. However, you can convert a GML file into a JSON file, which D3 can read. You can use NetworkX for this conversion.
Alternatively, you may use Gephi to export the edges and nodes to CSV separately.
I want convert an HTML report to PDF. I know that there are so many libraries are available for this purpose. But the HTML report contains so many graphs created using Jqplot. I want to include these graphs in the PDF also. If you are familiar with any library which also convert graphs to PDF, please give me the reference.
you can use bullzip pdf printer it creates a virtual pdf printer that can transform your HTML content to a pdf file from the browser:
http://www.bullzip.com/
you can also find a lot of useful tools right there!
I don't have experience with Jqplot, but I have successfully converted html pages which contain pie charts from Google Charts (completely javascript generated) to pdf.
I used wkhtmltopdf - it's a commandline tool but there are wrapper classes for php and some others I believe.
I'm sure you could find something applicable with a bit of googling but this looks promising: https://github.com/mikehaertl/phpwkhtmltopdf
I need to display some data online but I also would like to have nice plots as high-res files for printing. So far I was generating the plots as png, but now I am thinking on changing this to Javascript. This is mainly because I would like my plots to be dynamic.
The WWW part is looks relatively easy for me; I would grab data from a server with AJAX and plot on a webpage - I think SVG would be perfect for my needs. But how can I run the script from terminal with a file name as a parameter to get a myplot.svg (which of course will not be dynamic any longer) file that looks like the plot on the webpage?
Ideally I would like to have a single plotting subroutine in order to avoid duplicate code and to keep both versions looking the same.
So my questions are which framework should I use for SVG generation to make the terminal variant easy ?
You can use ImageMagick to convert a SVG to png:
ImageMagick convert svg to png
You can extract the generated SVG from a virtual DOM (with the same code as on your web page, perhaps with slightly differences regarding environment) when you use Node.js and jsdom
As mentioned in the comment I can recommend D3.js - Data Driven Documents for generating SVG the easy way.
An alternative for Node.js and jsdom might be Phantom.js.
Your task is not an easy one, but it's worth the effort. Good luck!