Convert d3.js svg code to standalone program - any suggestions?

I have some scripts written with d3.js that generate SVG diagrams. I would like to generate these diagrams using a standalone program - what is the easiest way I can convert these scripts to run in batch mode without a browser?

+6
source share
1 answer

You can:

  • Convert this to node.js program. You will have access to the file system and you can easily save the generated SVG. You will need node-canvas to replace the HTML canvas. See this d3 example to get started with d3 using node.

  • You can use the file system APIs in Chrome with your existing scripts to write files to your hard drive. It might be simpler because you just need to implement the file system code on top of what you already have. See this html5rocks article for information on writing to the local file system.

+7
source

Source: https://habr.com/ru/post/902167/


All Articles