Deployment example of dash_oop_components library.
Shows how you can use re-usable nested components to design your dash app:
- All components use the same
CovidPlots(DashFigureFactory) - Two plot components:
CovidTimeSeries(DashComponent)CovidPieChart(DashComponent)
- A
CovidComposite(DashComponent)that combines both plot components and adds dropdowns that control both components - A
CovidDashboard(DashComponent)that combines four differentCovidCompositesin four different configurations:- Asian countries only
- European countries only
- Cases only
- Deaths only
- The
CovidDashboardgets run by aDashApp.
Plus: the state of the app gets automatically saved to the url querystring!
dashboard_components.pycontains the definitions of theDashFigureFactoryandDashComponents:build_dashboard.pybuilds thedashboard.yamlconfigurationdashboard.pysimply loads the config and exposes the flask app:
build_dashboard.py
from dashboard_components import CovidPlots, CovidDashboard
from dash_bootstrap_components.themes import FLATLY
from dash_oop_components import DashApp
plot_factory = CovidPlots(datafile="covid.csv")
dashboard = CovidDashboard(plot_factory)
app = DashApp(dashboard, external_stylesheets=[FLATLY])
app.to_yaml("dashboard.yaml")dashboard.py
from dash_oop_components import DashApp
dashboard = DashApp.from_yaml("dashboard.yaml")
app = dashboard.app.serverAnd then run the dashboard with:
$ gunicorn --preload dashboard:appExample deployed at dash_oop_demo.herokuapp.com
This example is a rewrite of this Charming Data dash instruction video (go check out his other vids, they're awesome!).
