การสร้างแดชบอร์ดด้วย 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 component เช่น กราฟและอินพุต
app = Dash()app.layout = [dcc.Graph( id='example-graph', figure=bar_fig)]
Dash()app.layoutdcc.Graph()figure = Plotly figure ที่จะแสดงผลid = สำคัญสำหรับ callback ในภายหลัง
if __name__ == '__main__':
app.run(debug=True)
python my_app.py ใน command-linedebug ช่วยให้เห็น feedback ขณะทดสอบ
เข้าถึงได้ผ่านเว็บเบราว์เซอร์ เช่น Google Chrome
ขณะที่เซิร์ฟเวอร์ทำงานอยู่ แก้ไขและบันทึกไฟล์ .py เพื่อดูการเปลี่ยนแปลงแบบ live ในเบราว์เซอร์



การสร้างแดชบอร์ดด้วย Dash และ Plotly