mckinsey / vizro

Vizro is a toolkit for creating modular data visualization applications.
https://vizro.readthedocs.io/en/stable/
Apache License 2.0
2.73k stars 142 forks source link

Dynamic page/tab creation #902

Open gtauzin opened 4 days ago

gtauzin commented 4 days ago

Question

Hi vizro team!

Is it possible to allow a user to dynamically create a new page or a new tab?

Code/Examples

Maybe to illustrate what I mean, let me give you a naive example. Let's imagine I have the GDP over years of a bunch of country. In my navigation panel, I select a single country. On the pages side panel there is an icon with a "+" and if I click on it, I can create a new page on which I can select a different country and just change page to alternate GDP plot per selected countries.

Thanks a lot for your feedback! :)

Which package?

vizro

Code of Conduct

maxschulz-COL commented 4 days ago

Hey again @gtauzin :),

having a dynamic number of pages is tricky, but I will refer to @antonymilne for the final verdict, as he has worked on that before, but maybe you could look into this page to come up with alternative easier solutions: https://vizro.readthedocs.io/en/stable/pages/user-guides/custom-figures/#dynamic-number-of-cards

The example posted is about dynamic cards, but potentially you could have dynamic tabs, which might even be nicer when comparing a chart. Just an idea!

gtauzin commented 4 days ago

Hi @maxschulz-COL and thank you for your reply.

I have seen the dynamic card creation, but the idea is really to provide a new view to the user on which s/he can apply different filters and selectors. So dynamic pages creation would be really great. I would still be interested in dynamic tabs too as a backup plan or for new features! :)

gtauzin commented 2 days ago

I can confirm that I could make this works for dynamic tab creation based on the card example. This is the corresponding PyCafe example.

I also understand that the card example cannot be extended to pages are the custom figure is contained inside a page. Would love to know if there is any other way to dynamic pages! Thank you :)