mckinsey / vizro

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

Introduce `Container` model #254

Closed huong-li-nguyen closed 7 months ago

huong-li-nguyen commented 8 months ago

Description

Note: Tests and Docs will be done in a separate PR as this one is already quite big

Screenshot

Screenshot 2024-01-05 at 16 51 49

Notice

petar-qb commented 8 months ago

I would like to hear your thoughts on added _model_manager and _page helper methods, hence this thread is created.

Should they be where they are now, or should they be moved somewhere else?

Do we also need to make newly added _page helper methods more generic like:

and move them to the _model_manager?

l0uden commented 7 months ago

@huong-li-nguyen

I've found old bug from the previous branch of tabs an containers where table in one container overwrites title of the second container

image
l0uden commented 7 months ago

@huong-li-nguyen , can we do smth with x-axis name conflicting with the legend items? it is present on the main screenshot of this PR with four charts in the container.

huong-li-nguyen commented 7 months ago

@huong-li-nguyen , can we do smth with x-axis name conflicting with the legend items? it is present on the main screenshot of this PR with four charts in the container.

This has to be manually set by the user by providing a custom Layout and providing a row_min_height. This then activates scrolling. The other option would be to use custom charts and just turn off the legend. But generally all solutions have to be done via the configuration. Are you using this example for your tests right now?

huong-li-nguyen commented 7 months ago

@huong-li-nguyen

I've found old bug from the previous branch of tabs an containers where table in one container overwrites title of the second container

Thanks! I'll take a look later

l0uden commented 7 months ago

@huong-li-nguyen , can we do smth with x-axis name conflicting with the legend items? it is present on the main screenshot of this PR with four charts in the container.

This has to be manually set by the user by providing a custom Layout and providing a row_min_height. This then activates scrolling. The other option would be to use custom charts and just turn off the legend. But generally all solutions have to be done via the configuration. Are you using this example for your tests right now?

I'm using my own, but it has the same problem. I will try to use first option

antonymilne commented 7 months ago

@maxschulz-COL @huong-li-nguyen @petar-qb this all gets a kind of pre-approval from me šŸ’Æ I left lots of comments but once those are resolved let me know and I'll re-review and chances are very high it will be an approval šŸ˜€ Just give me a shout if it's easier to discuss the comments in person or work through them together instead of getting too many long comment threads on github.

huong-li-nguyen commented 7 months ago

I still need to review the actions stuff, but here's a partial review so you're not waiting too long...

Generally this looks great I think! Some general questions:

  1. Page.controls applies to all figures on the page, regardless of whether they're in a (possibly nested) container, right?
  2. did you test the case where you have Page.components = [vm.Container(), vm.Graph()], so a container and a non-container as siblings?
  3. are we saving the Container.controls field for a separate PR?
  4. for naming, I'd suggest maybe using grid more since ultimately that's what these classes and functions are for. They don't make sense without a Layout.grid.

@antonymilne - regarding your questions:

  1. Yes, that's the case
  2. Yes, I've also added a test example here: https://github.com/mckinsey/vizro/pull/254/commits/8ccf044ffe6c16cda937d6435fdb575b5545251f
  3. Container.controls will come later
  4. What does that refer to again? šŸ˜„

@l0uden - in https://github.com/mckinsey/vizro/pull/254/commits/8ccf044ffe6c16cda937d6435fdb575b5545251f I've also added the example with a Table and a Container and there is no overlapping anymore. Can you double-check if that's the bug you've referred to? :)

l0uden commented 7 months ago

I still need to review the actions stuff, but here's a partial review so you're not waiting too long... Generally this looks great I think! Some general questions:

  1. Page.controls applies to all figures on the page, regardless of whether they're in a (possibly nested) container, right?
  2. did you test the case where you have Page.components = [vm.Container(), vm.Graph()], so a container and a non-container as siblings?
  3. are we saving the Container.controls field for a separate PR?
  4. for naming, I'd suggest maybe using grid more since ultimately that's what these classes and functions are for. They don't make sense without a Layout.grid.

@antonymilne - regarding your questions:

  1. Yes, that's the case
  2. Yes, I've also added a test example here: 8ccf044
  3. Container.controls will come later
  4. What does that refer to again? šŸ˜„

@l0uden - in 8ccf044 I've also added the example with a Table and a Container and there is no overlapping anymore. Can you double-check if that's the bug you've referred to? :)

No, the bug is still reproducing. To do it just put table into the separate container. In your example it's just a graph.

huong-li-nguyen commented 7 months ago

@l0uden - got it! I've updated the example and added a fix. Can you check again? :)

I'll probably take that fix out and create a separate PR on main, such that @maxschulz-COL can pull it later for his PR on the ag-grid to see how it looks like šŸ‘

Screenshot 2024-01-19 at 10 56 40