Skip to content

Conversation

@felixpalmer
Copy link
Collaborator

For #7827

Background

Adds category filtering to DataFilterExtension

Screen.Recording.2023-05-25.at.14.11.00.mov

Change List

  • New accessor, getFilterCategory and filterCategories prop in DataFilterExtension
  • New option categorySize in DataFilterExtension to allow 1-4D filters
  • Enhancement to DataFilterExtension to support passing discrete values
  • DataFilterExtension shader module to perform GPU filtering
  • Test app updated to demonstrate usage
  • Tests
  • Render tests
  • Documentation

@coveralls
Copy link

Coverage Status

Coverage: 89.844% (+0.01%) from 89.831% when pulling dc1d53f on felix/data-filter-category into 98c1677 on master.

@kylebarron
Copy link
Collaborator

This looks really nice! What does this need to get over the line?

* Accessor to retrieve the category for each object that it will be filtered by.
* Returns either a number (if `filterSize: 1`) or an array of numbers.
*/
getFilterCategory?: Accessor<DataT, number | number[]>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work with a typed array passed into data.attributes.getFilterCategory as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixpalmer felixpalmer mentioned this pull request Jan 22, 2024
14 tasks
Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I just scanned the code so treat my comments as light nits and suggestions, I could easily have missed some points.

I think the interface may be a little inconvenient as filters are provided as an array of arrays rather than a Record<columnName, value[]>.

Not sure how much work it would be to support that, or if it makes sense.

* If `filterSize` is `1`: `[softMin, softMax]`
* If `filterSize` is `2` to `4`: `[[softMin0, softMax0], [softMin1, softMax1], ...]` for each filtered property, respectively.

##### `getFilterCategory` ([Function](../../developer-guide/using-layers.md#accessors), optional) {#getfiltercategory}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This name didn't click immediately for me. I would probably have gone with getDataFilterCategory (especially as we now have multiple "filter" extensions) but I guess the naming convention is somewhat fixed by now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love it either, I was trying to stay "consistent" with getFilterValue. I think we should stick with this or make both accessors consistent, e.g. use getDataFilterValue & getDataFilterCategory. This would be a breaking change, and I'm not sure it is worth it

```

* `filterSize` (Number) - the size of the filter (number of columns to filter by). The data filter can show/hide data based on 1-4 numeric properties of each object. Default `1`.
* `categorySize` (Number) - the size of the category filter (number of columns to filter by). The category filter can show/hide data based on 1-4 properties of each object. Default `1`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be auto-detected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps in a followup PR. But in that case filterSize should also support it. Part of me thinks it is good to have it be explicit as then the user intention is clear. For auto detection, should we use filterCategories or the getFilterCategory accessor? What if they don't match?

Format:

* If `categorySize` is `1`: `['category1', 'category2']`
* If `categorySize` is `2` to `4`: `[['category1', 'category2', ...], ['category3', ...], ...]` for each filtered property, respectively.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we avoid the overloading and always required nested array, and just use firm typescript typing?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be a map with column names?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I prioritized consistency with existing API here

@felixpalmer felixpalmer merged commit 9510fb0 into master Feb 21, 2024
@felixpalmer felixpalmer deleted the felix/data-filter-category branch February 21, 2024 18:33
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

Successfully merging this pull request may close these issues.

5 participants