1 d3.json('cumulativeLineData.json', function(data) {
2 nv.addGraph(function() {
3 var chart = nv.models.cumulativeLineChart()
4 .x(function(d) { return d[0] })
5 .y(function(d) { return d[1]/100 }) //adjusting, 100% is 1.00, not 100 as it is in the data
6 .color(d3.scale.category10().range());
7
8 chart.xAxis
9 .tickFormat(function(d) {
10 return d3.time.format('%x')(new Date(d))
11 });
12
13 chart.yAxis
14 .tickFormat(d3.format(',.1%'));
15
16 d3.select('#chart svg')
17 .datum(data)
18 .transition().duration(500)
19 .call(chart);
20
21 //TODO: Figure out a good way to do this automatically
22 nv.utils.windowResize(chart.update);
23
24 return chart;
25 });
26 });