Skip to content
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

Feature request: Change Selection Of Groups to Mimic File Browsers #996

Closed
JackStouffer opened this issue Aug 25, 2015 · 3 comments
Closed
Milestone

Comments

@JackStouffer
Copy link

In dc.js, when you click on a bar chart bar, and you already have another bar selected, both bars become selected. This is counterintuitive when compared to how most software, like file browsers, work. In file browsers, clicking on a separate item will deselect the previous item and select the currently clicked item. To select both, you would control/command click on the item. You could even go so far as to add shift clicking to select multiple at once. Changing this would make dc.js easier to use when comparing, for example, line charts controlled by a categorical row chart, as it would one take one click instead of two to compare each of the different groups.

BTW, this is not just me theorizing about what would make more sense. Most of the people using my system that was built with dc.js have complained about this as it bucks their expectations.

@gordonwoodhull
Copy link
Contributor

It would be good to have a way to define and specify the desired behavior, because there are actually a lot of different behaviors that different people expect.

The way to get what you want currently is this:

chart.on('pretransition', function(chart) {
    chart.selectAll("rect.bar").on("click", function (d) {
        chart.filter(null)
            .filter(d.data.key)
            .redrawGroup();
    });

@gordonwoodhull
Copy link
Contributor

One proposed PR is #601, supporting some of the features you mention.

Closing this as a duplicate of #716

@gordonwoodhull gordonwoodhull added this to the v2.1 milestone Aug 25, 2015
@gordonwoodhull
Copy link
Contributor

Updated code above - there is actually a moment you can "click on the old handler" if you use renderlet instead of pretransition. Also adding example here:

http://dc-js.github.io/dc.js/examples/bar-single-select.html

gordonwoodhull added a commit that referenced this issue Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants