mckinsey / vizro

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

Introduce `Tabs` model #280

Closed huong-li-nguyen closed 5 months ago

huong-li-nguyen commented 6 months ago

Description

Docs + Tests will be done in a separate PR

Screenshot

Screenshot 2024-01-23 at 19 02 12

Notice

huong-li-nguyen commented 6 months ago

Add example with non-charts

Yes, I noticed that as well, but I couldn't figure out where this comes from. I've added an example here: https://github.com/mckinsey/vizro/pull/280/commits/c6066b5eff1b7e145c50f4678bf265de72275bc2

Seems like the resizing doesn't appear with other components such as the Table and the Card. However the scrollbar does appear sometimes. I'll double-check that tomorrow

huong-li-nguyen commented 6 months ago

@antonymilne - I suspect it to be the plotly charts/dcc objects. I found this issue on dash: https://github.com/plotly/dash-core-components/issues/922, which still seems to be open. Our situation is similar to the example, but we do not set a fixed height for the figure beforehand; instead, our layouts set it dynamically. For instance, in our example page for the single tabs, the plotly charts initially have a height < 450px because the layout is set to fix the page without scrolling, and the charts dynamically update their width/height to fit their parent container.

What I assume happening is then when switching to a different tab, the plotly charts' height/width get reset to their original sizes (as explained in the issue). This leads to this short blinking effect and a scroll bar appearing for a second on the right, as with their actual size, they overflow their parent container. However, the scrolling bar disappears very quickly after they update their height/width again, but this blinking effect remains on the initial load.

I've double-checked with a pure dash app and you can also see this blinking/resizing happening there. I am not 100% sure why this behaves like it behaves 😄 but might be worth double-checking with @AnnMarieW 👍

AnnMarieW commented 6 months ago

Hi @huong-li-nguyen Yes, this is an open issue at Plotly and it's not an easy fix. The best workaround for now is to set the height. Maybe a clientside callback would be faster and help to reduce the flicker.

huong-li-nguyen commented 6 months ago

Hi @huong-li-nguyen Yes, this is an open issue at Plotly and it's not an easy fix. The best workaround for now is to set the height. Maybe a clientside callback would be faster and help to reduce the flicker.

Thanks @AnnMarieW for the quick reply! 🚀 That's very good to know! Yes, I've seen your answer on the thread, and setting a fixed height also works for us (in our case it's dynamically enforced by the size of the parent container). The blinking just happens when you switch the first time, afterwards it all works well!

antonymilne commented 6 months ago

Hi @huong-li-nguyen Yes, this is an open issue at Plotly and it's not an easy fix. The best workaround for now is to set the height. Maybe a clientside callback would be faster and help to reduce the flicker.

Thanks @AnnMarieW for the quick reply! 🚀 That's very good to know! Yes, I've seen your answer on the thread, and setting a fixed height also works for us (in our case it's dynamically enforced by the size of the parent container). The blinking just happens when you switch the first time, afterwards it all works well!

Cool, thank you very much for all this @huong-li-nguyen and @AnnMarieW! If it's not an easy one to fix then no worries, it definitely shouldn't block this feature being released. And we can put it on the backlog to look at again later.