This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pre-render d3 force-directed graph at server side | |
// Call node pre_render_d3_graph.js to generate d3_graph.html | |
// Original idea and framework borrowed from https://gist.github.com/mef/7044786 | |
var d3 = require('d3') | |
, jsdom = require('jsdom') | |
, fs = require('fs') | |
, htmlStub = '<html><head> \ | |
<style>.node { stroke: #fff; fill: #ccc; stroke-width: 1.5px; } \ | |
.link { stroke: #333; stroke-opacity: .5; stroke-width: 1.5px; }</style> \ |