matyuschenko
11/27/2015 - 3:21 PM

D3.js tricks & recipes

D3.js tricks & recipes

// line
data = [{month: 1, cost: 10}, {month: 2, cost: 20}]
var line = d3.svg.line()
  .x(function(d) { return d.month; })
  .y(function(d) {return height - d.cost;  })
var viz = svg.append('path')
  .attr(d, line(data)); // сюда передавать массив объектов с month и cost
  
// decoding
JSON.parse(window.atob(data))

// useful examples of fundamentials:
// https://c9.io/bsullins/