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

How do you filter data in a particular plot? #175

Open
tmcw opened this issue Sep 9, 2023 · 1 comment
Open

How do you filter data in a particular plot? #175

tmcw opened this issue Sep 9, 2023 · 1 comment

Comments

@tmcw
Copy link

tmcw commented Sep 9, 2023

From the documentation, I can see examples of filtering the entire dataset up-front, like in the example: https://uwdata.github.io/mosaic/examples/ in which we provide { where: "Symbol = 'AAPL'" } to filter just for AAPL.

I can't find an example or documentation of loading a larger dataset and showing subsets of it. Like, if in that example, we wanted a page in which we had AAPL, MSFT, and a few other stocks or whatever - in separate plots, how would that work? We probably wouldn't want to set up the executor again?

There's documentation for a query builder, but I don't see how this hooks up to charts: https://uwdata.github.io/mosaic/sql/

There's documentation for methods that seem like they create filtered sub-tables from parquet files: https://uwdata.github.io/mosaic/api/sql/data-loading.html

Is there a way to show a chart of data from a parquet file, but not all the data in the parquet file?

@jheer
Copy link
Member

jheer commented Sep 13, 2023

The filterBy property can be used to push down a client-specific filtering predicate. You can add your own predicate to a selection that is passed as a client filterBy parameter. However, this has the limitation that the predicate will then be applied to all clients subscribed to that selection. We've considered support for an additional "static" filtering predicate but have not added it yet. We're open to ideas and suggestions for expanding the API in an elegant way!

In the meantime, Plot also has a filter channel that vgplot respects. However, this uses a JavaScript predicate function applied to the retrieved query results, and so will not be pushed down to the database.

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