Py.Cafe

lingyielia/

vizro-gapminder-data-overview

Gapminder Data Overview

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro
from vizro.tables import dash_ag_grid

df = px.data.gapminder()

columnDefs = [
    {"field": "country", "minWidth": 600}, 
    {"field": "year"}, 
    {"field": "lifeExp", "cellDataType": "numeric"},
    {"field": "gdpPercap", "cellDataType": "dollar"}, 
    {"field": "pop", "cellDataType": "numeric"}
    ]


page = vm.Page(
    title="Default Dash AG Grid",
    components=[
        vm.Container(
            components=[
                vm.Card(text="test"),
                vm.Card(text="test2"),
            ],
            layout=vm.Flex(direction="row")
        ),
        vm.AgGrid(
            figure=dash_ag_grid(
                data_frame=df,
                columnDefs=columnDefs,
                # dashGridOptions={"pagination": True, "paginationPageSize": 20,},
                # style={"height": 1000}
                ),
            )
        ],
    layout=vm.Flex(direction="column")
)

dashboard = vm.Dashboard(pages=[page])
Vizro().build(dashboard).run()