Path: blob/main/doc/tutorials/basic/build_streaming_dashboard.md
2013 views
Build Streaming Dashboard
In this tutorial, we come together to create a simple streaming dashboard to monitor the wind speed and power output of one of our wind turbines:
We will use
pn.state.add_periodic_callback
to trigger a task to run on a schedule.
:::{note} When we ask to run the code in the sections below, you may either execute the code directly in the Panel docs via the green run button, in a cell in a notebook, or in a file app.py
that is served with panel serve app.py --dev
. :::
Install the Dependencies
Please ensure that SciPy is installed.
::::{tab-set}
:::{tab-item} conda :sync: conda
:::
:::{tab-item} pip :sync: pip
:::
::::
Build the App
Run the code below:
Try changing the period
from 1000
to 100
.
:::{note} The code refers to
wind_speed = pn.rx(8.0)
: This is a reactive expression with an initial value of 8.0. The UI updates whenever the valuewind_speed.rx.value
is changed.pn.state.add_periodic_callback(update_wind_speed, period=1000)
: This updates thewind_speed_rx.value
every 1000 milliseconds. :::