shutterstock/rickshaw — pull request #120 by jhollingworth (2012-09-10 10:24:26+00:00)
Title: Rickshaw running on Node.js

Hi,

I have got Rickshaw running in node.js so you render SVGs on the server. The only two changes I needed to make were:

1. Exporting the Rickshaw object (i.e. module.exports)
2. Replacing self with window in ClassList to get it to run properly

Here's an example of how to get get an SVG in node.js:

```javascript
var Rickshaw = require('./lib/rickshaw')

var seriesData = [ [], [], [] ];
var random = new Rickshaw.Fixtures.RandomData(150);

for (var i = 0; i < 500; i++) {
random.addData(seriesData);
}

var el = window.document.createElement("div")
el.setAttribute("chart")

var graph = new Rickshaw.Graph({
element: el,
width: 960,
height: 500,
renderer: 'scatterplot',
series: [
{
color: "#ff9030",
data: seriesData[0],
}, {
color: "#ff4040",
data: seriesData[1],
}
]
} );

graph.renderer.dotSize = 6;
graph.onUpdate(function() {
console.log(el.innerHTML)
})

graph.render();
```

Thanks,
James