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

Regarding issue in dc bar chart ordinal scale brush selection #1770

Closed
shijocj opened this issue Sep 17, 2020 · 1 comment
Closed

Regarding issue in dc bar chart ordinal scale brush selection #1770

shijocj opened this issue Sep 17, 2020 · 1 comment

Comments

@shijocj
Copy link

shijocj commented Sep 17, 2020

I am using dc version 3.0.2, d3 version 5.15.0 and crossfilter version 1.3.12 .I have multiple row charts and one bar chart, and my bar chart has ordinal values and need to implement brush selection(range filter) on bar chart.

When I go through the dc.js documentation I found that ordinal scale won't support brush selection. So I followed the brush ordinal example, and I implemented the same logic. When it comes to interaction in charts, if I select any item in bar chart using brush selection, it's working as intended and reflecting in row charts. However, when I click any item in row charts, it's not reflected in the bar chart - filtering is not happening in the bar chart.

I guess the brush ordinal example I mentioned above is also not working correctly, because if I click any of the item in row chart , bar chart displaying negative values in Y axis. I think the result is wrong.

@gordonwoodhull
Copy link
Contributor

There were two problems in the example:

  1. sort_group was calling group.all().sort(), which you should not do, because group.all() returns a reference to an internal array. If you copy the array using .slice(), then it is safe.
  2. Coordinate grid charts currently need to be told when the the X domain changes, by calling .rescale(). Since this was not called, the tick labels did not update on the bar chart when filtered.

I've fixed the example in version 4.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants