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

'filtered' eventlistener is fired twice when "Others" is clicked in rowChart #712

Open
medigvijay opened this issue Sep 24, 2014 · 1 comment
Labels
Milestone

Comments

@medigvijay
Copy link

I have a rowChart and using rowsCap to show rest(i.e. other than top five) of the filters as "Others".
But when I click on the "Others" row the "filtered" listener is fired twice instead of once.
I understand that it adds "Others" to filters, but from a users point of view I don't expect the listener to be fired twice.

chart.on("filtered", function(chart, filter) { console.log(filter); // twice first the array and secondly the "Others" }

@gordonwoodhull
Copy link
Contributor

Good question. The reason is that in the cap mixin, it is separately handling filtering all of the individual keys of the Others, and filtering the Others key itself. So it filters twice.

https://github.com/dc-js/dc.js/blob/master/src/cap-mixin.js#L101

If you say, "wait, that seems kind of inefficient; doesn't that mean it's recalculating the crossfilter twice?" Well yes, it is, and the same lack of expressivity in the filter primitives is present in a few other places (as well as in custom filter behaviors).

#716 should fix this.

@gordonwoodhull gordonwoodhull changed the title Why the 'filtered' eventlistener is fired twice when "rowsCap" i.e. "Others" is clicked in rowChart 'filtered' eventlistener is fired twice when "Others" is clicked in rowChart Nov 29, 2014
@gordonwoodhull gordonwoodhull added this to the v2.1 milestone Nov 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants