使用 Dash 與 Plotly 建立儀表板
Alex Scriven
Data Scientist
一個完整的 Dash 應用:
from dash import Dash, dcc
app = Dash()
app.layout = [dcc.Graph(id='example-graph', figure=bar_fig)]
if __name__ == '__main__':
app.run(debug=True)
print("f{my_variable}")
from dash import Dash, dcc
Dash 用來初始化應用 dcc 提供圖表、輸入等 UI 元件
app = Dash()app.layout = [dcc.Graph( id='example-graph', figure=bar_fig)]
Dash() 建立應用物件app.layoutdcc.Graph()figure = 要呈現的 Plotly 圖形id = 之後回呼很重要
if __name__ == '__main__':
app.run(debug=True)
python my_app.pydebug 可在測試時提供回饋
透過瀏覽器(如 Google Chrome)存取
服務啟動中,更新並儲存 .py 檔即可在瀏覽器即時看到變更



使用 Dash 與 Plotly 建立儀表板