Building Dashboards with Dash and Plotly
Alex Scriven
Data Scientist
html.Table
static → limited$$
from dash_ag_grid import AgGrid
column_defs = [ {"field": "Major Category"}, {"field": "Total Sales ($)"}, {"field": "Sales Volume"}, ]
grid = AgGrid( columnDefs=column_defs,
rowData=major_cat_tb.to_dict("records"))
app.layout = [grid]
valueFormatter
money_fmt = { "function": ( """params.value.toLocaleString( 'en-US', {style: 'currency', currency: 'USD'})""" )}
column_defs = [ {"field": "Major Category"}, {"field": "Total Sales ($)", "valueFormatter": money_fmt}, {"field": "Sales Volume"} ] # Add to layout as before
# Turn off globally grid = AgGrid( defaultColDef={"sortable": False} )
# Specify for a column column_defs = [ {"field": "Major Category" , "sortable": True}, # Turn on {"field": "Sales Volume" , "sortable": False} # Turn off ]
$$
grid = AgGrid(
defaultColDef={
"filter": True
, "floatingFilter": True}
)
$$
$$
$$
grid = AgGrid(
dashGridOptions={
"pagination": True,
"paginationPageSize": 2
}
$$
Building Dashboards with Dash and Plotly