-
-
Save stevebrewer/4205065 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var ALL_CHARTS = [] | |
var REFRESH_ALL_CHARTS = function(){ | |
for(var i = 0; i < ALL_CHARTS.length; i++){ | |
ALL_CHARTS[i].update(); | |
} | |
} | |
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); | |
ALL_CHARTS.push(chart) | |
return chart; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment