Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting d3.js SVG code to a standalone program -- any suggestions?

I have some scripts written with d3.js that generate SVG charts. I'd like to generate those charts with a standalone program -- what is the easiest way I can convert those scripts to run in batch mode, without a browser?

like image 790
Anthony Blake Avatar asked Nov 23 '11 00:11

Anthony Blake


1 Answers

You could:

  1. Convert this to a node.js program. You'd have access to the filesystem and would be able to save generated SVGs easily. You'd need node-canvas to replace the HTML canvas. See this d3 example to get started using d3 with node.

  2. You could use the filesystem APIs in Chrome with your existing scripts to write files to the hard disk. This may be easier, because you would just need to implement the filesystem code on top of what you have already. See this html5rocks article for information on writing to the local file system.

like image 147
ampersand Avatar answered Oct 24 '22 05:10

ampersand