Skip to content

Instantly share code, notes, and snippets.

@tbisaacs
Created December 4, 2012 15:16
Show Gist options
  • Save tbisaacs/4205048 to your computer and use it in GitHub Desktop.
Save tbisaacs/4205048 to your computer and use it in GitHub Desktop.
nv.addGraph(function() {
var chart = nv.models.linePlusBarChart()
.margin({top: 0, right: 50, bottom: 25, left: 50})
.x(function(d,i) { return i })
.color(d3.scale.category10().range());
chart.xAxis.tickFormat(function(d) {
var dx = testdata[0].values[d] && testdata[0].values[d].x || 0;
return dx ? d3.time.format('%x')(new Date(dx)) : '';
});
chart.y1Axis
.tickFormat(d3.format(',f'));
chart.y2Axis
.tickFormat(function(d) { return '$' + d3.format(',.2f')(d) });
chart.bars.forceY([0]);
//chart.lines.forceY([0]);
d3.select('#revenue_metric_1 svg')
.datum(testdata)
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment