-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Enable variant argument inside
Container
(#1002)
- Loading branch information
1 parent
f12070d
commit de81e39
Showing
14 changed files
with
264 additions
and
168 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
vizro-core/changelog.d/20250217_105619_huong_li_nguyen_styled_containers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- | ||
A new scriv changelog fragment. | ||
Uncomment the section that is right (remove the HTML comment wrapper). | ||
--> | ||
|
||
<!-- | ||
### Highlights ✨ | ||
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1)) | ||
--> | ||
<!-- | ||
### Removed | ||
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1)) | ||
--> | ||
### Added | ||
|
||
- Enable styling of `vm.Container` with a new argument `theme="plain"/"filled"/"outlined"`. See the user guide on [styled containers](https://vizro.readthedocs.io/en/stable/pages/user-guides/container/#styled-containers) for more details. ([#1002](https://github.com/mckinsey/vizro/pull/1002)) | ||
|
||
<!-- | ||
### Changed | ||
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1)) | ||
--> | ||
<!-- | ||
### Deprecated | ||
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1)) | ||
--> | ||
<!-- | ||
### Fixed | ||
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1)) | ||
--> | ||
<!-- | ||
### Security | ||
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1)) | ||
--> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,67 @@ | ||
"""Test app""" | ||
|
||
import vizro.models as vm | ||
import vizro.plotly.express as px | ||
from vizro import Vizro | ||
from vizro.tables import dash_ag_grid | ||
from vizro.models.types import capture | ||
from vizro.figures import kpi_card | ||
|
||
tips = px.data.tips() | ||
iris = px.data.iris() | ||
|
||
first_page = vm.Page( | ||
title="Data", | ||
page = vm.Page( | ||
title="Page with subsections", | ||
layout=vm.Layout(grid=[[0, 0, 1, 1, 2, 2], [3, 3, 3, 4, 4, 4], [3, 3, 3, 4, 4, 4]]), | ||
components=[ | ||
vm.AgGrid( | ||
figure=dash_ag_grid(tips), | ||
footer="""**Data Source:** Bryant, P. G. and Smith, M (1995) | ||
Practical Data Analysis: Case Studies in Business Statistics. | ||
Homewood, IL: Richard D. Irwin Publishing.""", | ||
vm.Card(text="""Hello, this is a card with a [link](https://www.google.com)"""), | ||
vm.Card(text="""Hello, this is a card with a [link](https://www.google.com)"""), | ||
vm.Card(text="""Hello, this is a card with a [link](https://www.google.com)"""), | ||
vm.Container( | ||
title="Container I", | ||
components=[ | ||
vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")), | ||
], | ||
variant="outlined", | ||
), | ||
vm.Container( | ||
title="Container II", | ||
components=[ | ||
vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")), | ||
], | ||
variant="filled", | ||
), | ||
], | ||
) | ||
|
||
second_page = vm.Page( | ||
title="Summary", | ||
page_two = vm.Page( | ||
title="Container", | ||
components=[ | ||
vm.Figure( | ||
figure=kpi_card( | ||
data_frame=tips, | ||
value_column="total_bill", | ||
agg_func="mean", | ||
value_format="${value:.2f}", | ||
title="Average Bill", | ||
) | ||
vm.Container( | ||
title="Container III", | ||
components=[ | ||
vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")), | ||
], | ||
), | ||
vm.Figure( | ||
figure=kpi_card( | ||
data_frame=tips, value_column="tip", agg_func="mean", value_format="${value:.2f}", title="Average Tips" | ||
) | ||
], | ||
) | ||
|
||
page_three = vm.Page( | ||
title="Container Style", | ||
components=[ | ||
vm.Container( | ||
title="Container I", | ||
components=[ | ||
vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")), | ||
], | ||
variant="outlined", | ||
), | ||
vm.Tabs( | ||
tabs=[ | ||
vm.Container( | ||
title="Total Bill ($)", | ||
components=[ | ||
vm.Graph(figure=px.histogram(tips, x="total_bill")), | ||
], | ||
), | ||
vm.Container( | ||
title="Total Tips ($)", | ||
components=[ | ||
vm.Graph(figure=px.histogram(tips, x="tip")), | ||
], | ||
), | ||
vm.Container( | ||
title="Container II", | ||
components=[ | ||
vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")), | ||
], | ||
variant="filled", | ||
), | ||
], | ||
) | ||
|
||
dashboard = vm.Dashboard(pages=[first_page, second_page]) | ||
|
||
dashboard = vm.Dashboard(pages=[page, page_two, page_three]) | ||
|
||
if __name__ == "__main__": | ||
Vizro().build(dashboard).run() |
Oops, something went wrong.