i using nvd3.js , trying add click event
d3.selectall(".nv-bar").on('click', function () {console.log("test");});
how can ?
i running same issue , dump nvd3 because of lack of documentation... need add callback function addgraph(). note d3.selectall() instead of d3.select().
good luck.
nv.addgraph(function() { var chart = nv.models.multibarhorizontalchart() .x(function(d) { return d.label }) .y(function(d) { return d.value }) .margin({top: 5, right: 5, bottom: 5, left: 5}) .showvalues(false) .tooltips(true) .showcontrols(false); chart.yaxis .tickformat(d3.format('d')); d3.select('#social-graph svg') .datum([data]) .transition().duration(500) .call(chart); nv.utils.windowresize(chart.update); return chart; },function(){ d3.selectall(".nv-bar").on('click', function(){ console.log("test"); }); });
Comments
Post a Comment