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

filterMultiple #5

Closed
jasondavies opened this issue Mar 19, 2012 · 7 comments
Closed

filterMultiple #5

jasondavies opened this issue Mar 19, 2012 · 7 comments
Milestone

Comments

@jasondavies
Copy link
Collaborator

It would be great to filter on multiple values at once i.e. analogous to SQL's IN (…). I guess it makes implementation a bit more complicated because you're no longer just looking for a single range at a time. Alternatively, I guess I could create one dimension for each possible value, and then compute the union afterwards (but instantiating so many dimensions might be expensive?).

In case you haven't guessed yet, I'm seeing how easy it is to implement multi-faceted drilldown. :)

@wjbuys
Copy link

wjbuys commented Mar 23, 2012

+1: This is essential for working with qualitative dimensions. Perhaps that should be a first-class concept: a dimension with a low cardinality and weakly ordered values.

@mbostock
Copy link
Collaborator

Related: Allow records to have multiple values for a single dimension, such as labels or tags.

Related: Allow independent filters on the same dimension. These could be intersected or unioned.

@jasondavies
Copy link
Collaborator Author

That would be awesome! I have a dataset with a multi-valued field, and managed to make it filter on this field by generating a new record for each value in the field for each original record (thus making it ~10x larger). Then I used a custom reduce function to ensure the counts and summations were only on unique records (keyed by a unique ID per original record). I think this uniqueness checking hurt the performance quite a bit though so it would be great to do this efficiently internally.

Something like this might work:

t.dimension.multiple(function(d) { return d.multipleValues; });

Independent filters on the same dimension with union and intersection would solve my filterMultiple question; let me know if I can help with anything.

@michael
Copy link

michael commented Apr 6, 2012

Any updates on this? I need it! Very urgent :)

In terms of the API, why not allowing value accessing functions returning arrays?

var countries = crossfilter([
  {name: "USA", languages: ["Spanish", "English", "Chinese", "French"]},
  {name: "Canada", languages: ["French", "English"]}
]);

countriesByLanguage = countries.dimension(function(d) {return d.languages });
countriesByLanguage.filter('English');

countriesByLanguage.top(Infinity) // => [USA, Canada]

FYI: I'm currently stripping down Data.js, in order to make it fast and to remove unneeded complexity. I'm going to drop the Data.Hash datastructures in favor of native Javascript primitives (arrays, objects). At the end of the day it should no longer be a Data Manipulation Library, but a Data Representation Library, letting users use Crossfilter for the sake of filtering.

@zackham
Copy link

zackham commented Apr 12, 2012

Can someone more familiar with the codebase comment on the feasibility of doing this?

@christophe-g
Copy link

+1, agree with wjbuys above.

The lib is fantastic, but it really need support multiple values for being used in most real-world cases dealing with qualitative dimension.
Is there any chance this feature will be integrated one day ?
Cheers,
C.

@RandomEtc
Copy link
Collaborator

As discussed in #151 an active fork is being developed in a new Crossfilter Organization. Please take further discussion there (if you haven't already) where it should be warmly welcomed by the new maintainers. Cheers!

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

7 participants