Skip to content

Conversation

@bprusinowski
Copy link
Collaborator

@bprusinowski bprusinowski commented May 27, 2025

Closes #2297
Closes #2373
Closes #2422
Closes #2425
Closes #2427
Closes #2428
Closes #2431
Closes #2433

This PR adds support for displaying interactive filters based on multi-filters.

  • interactiveFiltersConfig is now present in every chart type, including tables
  • any place that uses MultiFilterField can enable interactive filter now, including selecting a default value
  • interactive filters based on multi-filters can select No filter value in the dropdown to show full data

How to test

  1. Go to this link.
  2. Switch to a table chart.
  3. Open Kanton column.
  4. Toggle Interactive switch.
  5. ✅ See that it's possible to filter the table using interactive filter (and that it starts with No filter value by default).
  6. ✅ See that it's possible to choose a default interactive filter value.
  7. ✅ See that when editing configurator filters, and un-selecting default interactive filter value, it resets to None.
  8. Switch to a map chart.
  9. ✅ See that interactive filters can also be enabled from the multi-filter panel and work in the same way as for tables.

  • I added a CHANGELOG entry
  • I made a self-review of my own code
  • I wrote tests for the changes (if applicable)
  • I wrote configurator and chart config migrations (if applicable)

@vercel
Copy link
Contributor

vercel bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
visualization-tool Ready Ready Preview Comment Sep 1, 2025 9:02am

@bprusinowski bprusinowski changed the title feat: Interactive filters are always defined feat: Interactive multi filters Jul 31, 2025
@bprusinowski bprusinowski merged commit 8d5bedc into main Sep 3, 2025
13 of 14 checks passed
@bprusinowski bprusinowski deleted the explore/table-interactive-filters branch September 3, 2025 06:50
@zumbov2
Copy link

zumbov2 commented Sep 9, 2025

Hi @bprusinowski, thanks a lot for the update! We’ve tested the interactive filters extensively and are really happy with the new feature. While testing, we noticed a few points we’d like to raise:

  • The placeholder shown when no filter is selected is not consistent across filter types. In addition, we think a more inviting label like “Select filter” would work nicely. :)
grafik
  • We observe a somewhat strange behaviour with time filters when setting up a table.
  1. Initial state: On load, the full timespan (1990-2024) is displayed correctly. In the filter panel, the option “Letztes Datum verwenden” is available.
  2. “Spalte ausblenden”: When I hide the column, the table automatically reduces to just the first year (1990). In the filter panel, the full range (1990-2024) is still shown as selected. The option “Letztes Datum verwenden” disappears.
  3. “Spalte einblenden (or better deactivate ”Spalte ausblenden"): When the column is shown again, the table still only displays 1990, even though the filter panel still shows the full range.
  4. Interaction with slider: Moving the slider in the filter panel re-synchronizes the table with the selected range, and the “Letztes Datum verwenden” option reappears.
grafik
  • Filters currently don’t seem to account for hierarchical dependencies. I assume this was not part of the original scope, but just to clarify if that’s the intended behavior: In the dataset “Marktzahlen Milch und Milchprodukte – Jährliche Konsumentenpreise”, if I select Produktgruppe = Butter, the second filter (Produktuntergruppe) still shows all subgroups, even those unrelated to Butter.
grafik
  • The year slider is missing the title. I assume this might be due to limited space, but having it displayed might improve consistency.

  • A pre-applied sort order on a table column isn’t visible to the user. Permanently showing the sorting arrow (the same way it is shown when a user actively sorts the table) would both make the initial sort order understandable and also more clearly signal that the table is in fact sortable.

@bprusinowski
Copy link
Collaborator Author

Hi @zumbov2, thanks a lot for the feedback, it's super valuable! We will address these issues next week.

cc @sosiology

@bprusinowski
Copy link
Collaborator Author

Hi @zumbov2 👋

Several issues you mentioned (and one from @l00mi) should be fixed soon via #2448.

I have a few comments for the last points you raised:

Filters currently don’t seem to account for hierarchical dependencies

Generally, I think we didn't discuss this use case during our syncs – it's a bit different situation that we have with interactive multi filters compared to single filters we support for years now, where we have a cascading behavior (left-side filters constrain the values of right-side filters). We couldn't re-use the same approach here, as we can e.g. only have a value selected in the right-side filter, leaving left-side one in an empty state.

I am not sure if this is 100% clear, but generally changing this behavior could be a more complex thing that would take some time (to have e.g. a Power BI-like behavior). Let me know if this is something that's important for you, I think we should still have time to potentially investigate this – but it's also hard to estimate how much it would take.

Year slider missing a title

This should be a minor change to make, but we've left it out for now to not occupy additional space, specially on mobile and in embed mode (we also technically do not have title for other interactive slider in other places). As usually we have only one temporal dimension in a dataset, it seemed like a valid "omission", but again – let me know if this is something you'd like to have implemented in the app 👍

Permanently showing the sort arrow

I've reached out to a designer working on Visualize to double check this, to also check what she thinks and will reach out to back to you.

cc @adintegra

@zumbov2
Copy link

zumbov2 commented Sep 16, 2025

Hey @bprusinowski, thanks a lot!

I wasn’t fully aware of the hierarchical possibilities of single filters, but Michael brought me up to speed five minutes ago. I guess those would cover what we had in mind for now. Sorry!

Year slider missing a title: I see your point, and the omission is fine by us.

Permanently showing the sort arrow: Thanks for checking with the designer - I'm happy for you to keep me in the loop.

Looking forward!

@bprusinowski
Copy link
Collaborator Author

Hi @zumbov2, great to hear this! Just a note, so we are on the same page: interactive single filters can be applied to other chart types, not tables (so the issue you mentioned would potentially need to be solved in a different way).

Thanks also for your feedback on the slider title, we'll leave the title out for now then. In the meantime I checked with our designer and made a change so that the sorting arrows are always shown at 50% opacity when not custom sorted by the end user; and 100% when sorted, like before.

The changes should be ready for testing in #2448.

Let me know in case of any additional feedback!

@zumbov2
Copy link

zumbov2 commented Sep 16, 2025

Sorry, me again. 🤦‍♂️

I've just realised that I can't simply select a higher-level category and automatically include all its subcategories in the hierarchical single filters. Was this ever considered?

grafik

@bprusinowski
Copy link
Collaborator Author

@zumbov2 yes, this is controlled at the data level, you can see that in another dataset it's possible to select "parent" values: https://test.visualize.admin.ch/en/v/joZisQ8kgqwP?dataSource=Prod

Generally we support both cases, when hierarchy has value and is simply a bucket to group other values 👍

@zumbov2
Copy link

zumbov2 commented Sep 16, 2025

Hi @zumbov2, great to hear this! Just a note, so we are on the same page: interactive single filters can be applied to other chart types, not tables (so the issue you mentioned would potentially need to be solved in a different way).

Hey @bprusinowski

In our case, it’s mostly about nested data structures: for a given political referendum, we have a higher-level status category (e.g. Laufend) and a more granular subcategory (e.g. Unterschriftenprüfung).

Initially, I thought we would need to have two filters (one for the higher level and one for the lower level), and that it would look odd if the lower level didn’t correspond to the first one. But with the hierarchical possibilities of single filters, we can avoid that.

@bprusinowski
Copy link
Collaborator Author

Ah, I see – you're right, hierarchies sound like a good use case here 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment