Reputation: 493
dc.js allows clickable bar charts only for ordinal values From dc.js:
if (_chart.isOrdinal())
bars.on("click", _chart.onClick);
I tried the following and got Uncaught TypeError: Cannot read property 'isFiltered' of undefined at dc.js
chart.renderlet(function(_chart){
_chart.selectAll("rect.bar").on("click", _chart.onClick);
});
https://github.com/dc-js/dc.js/issues/168 suggests to implement custom onClick handler but I am not sure what its content should be.
Upvotes: 1
Views: 451
Reputation: 20120
I have been hearing about this error for a while, and finally tracked it down. The advice to use .on("click", _chart.onClick)
is generally good, but it got broken by the bar chart's version of onClick
becoming private for some reason. (For details, see my comment in the issue cited above.)
Two possible solutions:
chart.renderlet(function(_chart){
_chart.selectAll("rect.bar").on("click", function(d) {
_chart.onClick(d.data);
});
});
Upvotes: 2