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

Suggestion for faster dc.filterAll() #1322

Open
ehansis opened this issue Jul 19, 2017 · 2 comments
Open

Suggestion for faster dc.filterAll() #1322

ehansis opened this issue Jul 19, 2017 · 2 comments

Comments

@ehansis
Copy link

ehansis commented Jul 19, 2017

I have built a dashboard with ~10 graphs and lots of data (which, unfortunately, I cannot share). Calling dc.filterAll() on it is pretty slow, taking 10-15 seconds. The default implementation of dc.filterAll() calls .filterAll() on each chart. Is there a reason why this couldn't be limited only to charts that actually have filters set? In my use cases, this typically applies only to a few charts. The following version works much quicker for me:

    function myFilterAll() {
        var charts = dc.chartRegistry.list();
        for (var i = 0; i < charts.length; ++i) {
            if (charts[i].hasFilter()) {
                charts[i].filterAll();
            }
        }
    }

I'm on dc.js version 2.1.4 (but the code for dc.filterAll() seems to be identical in the current 2.1.8).

@gordonwoodhull
Copy link
Contributor

I'm surprised that crossfilter doesn't notice when filterAll is a no-op, but after briefly scanning the code I am pretty sure it does not.

That would be the best place to fix this. However, I'd certainly take a pull request for dc.js with the above logic. Thank you!

@ehansis
Copy link
Author

ehansis commented Jul 24, 2017

OK, just submitted a PR.

My changes of the tests are a bit shaky - I haven't worked with this toolset before. Tests pass, but they are not overly smart.

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