-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable onClick for bar charts with quantitative scales. #633
Comments
I think the answer has to do with the way selection is baked into the charts. So, since bar charts with an ordinal x axis have click-to-select, whereas charts with quantitative x axes have brush-to-select, it was implemented this way. If you want something besides those selection modes (or don't want selection at all), it might make sense to want to override onClick. |
Hey there. Was looking for an explanation for this, and just found the answer in #168 |
@emiguevara: Sure... it was developed for a demo and became wildly popular because it provides a nice abstraction, wrapping the data. And a lot of different people contributed stuff, who all had different ideas how it should work. So it was never really designed in any consistent way. I tell myself that I'll start over with a consistent design in 3.0, but there are a lot of charting libraries that died when someone started a rewrite, so for now I'm just trying to fix bugs. :-) Although it's pretty easy to add this with a renderlet, I'll see about doing it automatically in 2.1. (If it conflicts with the brush, then only when brushing is off.) |
Question answered. Retitling. |
any updates on this? It still doesn't seem changed |
Nope. But dc.js is an intentionally leaky abstraction, so you can almost always work around these quirks. chart.on('pretransition', function(chart) {
chart.selectAll('rect.bar').on('click.yourNamespace', function(d) {
// do stuff here - d contains the datum
});
}); Patches welcome! |
The new ordinal range/focus example shows how to implement ordinal-style click-to-toggle on a linear scale chart. I think the code should suffice for any place one wants to enable clicking instead of brushing on a bar chart. If not, we could add another example. |
title says it all.
seems to be enabled for all other charts except for line charts (where probably the dots would make the most sense).
The text was updated successfully, but these errors were encountered: