I am trying to do an drill-down on bar graph using NVD3.js library. Chart has been made successfully. now I want to call an Json API by clicking on a particular bar so that new chart can be generated as per the parameter.
nv.addGraph(function() {
var chart = nv.models.discreteBarChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.showValues(true)
.duration(1000)
.showLegend(true)
;
d3.select('#chart1 svg')
.datum(data)
.transition().duration(500)
.call(chart);
chart.discretebar.dispatch.on("elementClick", function(e) {
alert("You've clicked " + e.data.label);
});
d3.select('#chart1 svg').datum(historicalBarChart).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
I get the alert with the label value of the bar on which i clicked. Now I want to call an Json API instead of alert.
Kindly help
Thanks