Skip to content

Instantly share code, notes, and snippets.

@maowug
Created May 29, 2013 00:37
Show Gist options
  • Save maowug/5667193 to your computer and use it in GitHub Desktop.
Save maowug/5667193 to your computer and use it in GitHub Desktop.
nvd3 in controller
getRNIAapp.controller('nvd3TogoCtrlPC',function(rniaWrapper){
var chart;
nv.addGraph(function() {
chart = nv.models.parallelCoordinates()
.width(nv.utils.windowSize().width*0.6)
// .height(nv.utils.windowSize().height)
// .dimensions(['nausea','temperature','headache','flu']);
.dimensions(rniaWrapper.get('graphPCDataWrapper').dimensions);
// console.log([{nausea:2, flu:"3", temperature:"0", headache:"1"},
// {nausea:3, flu:"1", temperature:"2", headache:"3"}]);
//
// console.log(rniaWrapper.get('graphPCDataWrapper').data);
d3.select('#chart-nvd3TogoCtrlPC svg')
.datum(rniaWrapper.get('graphPCDataWrapper').data)
.transition()
.duration(1000)
.call(chart);
// .datum([{nausea:2, flu:"3", temperature:"0", headache:"1"},
// {nausea:3, flu:"1", temperature:"2", headache:"3"}])
chart.dispatch.on('brush', function(e) {
nv.log(e);
});
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