Key Takeaways: Dash Dashboards
-
Callbacks are reactive declarations. The chapter's threshold concept: in Dash, you declare which output depends on which inputs, and the framework calls your function when the inputs change. This is not imperative event handling — it is dependency declaration, similar to how a spreadsheet formula depends on its cells.
-
Layout + callbacks = app. A Dash application has two parts: a layout (tree of html and dcc components) and callbacks (decorated functions). The layout is static; the callbacks modify it in response to user interaction.
-
Components have IDs and properties. Every component gets an
id=(for callback references) and has component-specific properties likefigure,value,children,style. Callbacks connect properties viaOutput(id, property)andInput(id, property). -
Dash uses Plotly for charts. The
dcc.Graphcomponent accepts any Plotly figure. This means the Plotly Express and Graph Objects material from Chapters 20-21 applies directly — you build the figure with Plotly, you pass it todcc.Graph. -
Cross-filtering is Dash's killer feature.
clickData,selectedData, andhoverDataon charts emit events that callbacks can consume. Clicking one chart can filter another — a pattern that is native in Dash and awkward in Streamlit. -
Dash Bootstrap Components add polish.
dbc.Container,dbc.Row,dbc.Col,dbc.Card, and friends provide responsive, styled layouts without writing CSS. Installdash-bootstrap-componentsand use the BOOTSTRAP theme. -
dcc.Intervalenables auto-refresh. Set an interval in milliseconds, and a callback fires periodically. Use for live dashboards, real-time monitoring, and anything that needs automatic updates. -
Multi-page apps use
dash.register_page. Put pages in apages/folder, useuse_pages=True, and Dash handles routing between pages. Thepage_containercomponent renders the current page. -
Deployment uses standard Python web patterns. Gunicorn runs the Flask server behind Dash. Nginx provides TLS and reverse proxy. Docker packages everything. This stack is more operational work than Streamlit Cloud but gives full control.
-
Dash vs. Streamlit is a tool choice, not a competition. Streamlit is faster for simple dashboards; Dash is better for complex ones. Most mature teams use both — Streamlit for prototypes, Dash for production. Knowing when to reach for each is the skill.
Chapter 31 moves from interactive dashboards to automated reporting — Python scripts that generate PDFs, slides, and email reports on schedules. Dashboards and reports are complementary: dashboards for users who want to explore, reports for users who want answers pushed to them.