[英]Plotly-Dash displays the wrong graph (line plot instead of funnel)
我正在嘗試使用破折號和繪圖顯示一個簡單的漏斗圖。 問題是它顯示了一個折線圖。
我按照this answer中的說明進行操作,即使用了代碼:
app = dash.Dash()
app.layout = html.Div([dcc.Graph(id='FunnelDashboard',
figure = {'data':[
go.Funnel(
y = ["Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"],
x = [39, 27.4, 26.6, 11, 2])]
}
)])
if __name__ == '__main__':
app.run_server()
但我得到了這條線圖。
我期望得到的是這樣的。
更新破折號:
pip install -U dash
使用版本1.9.1
,使用以下代碼:
import dash
import dash_html_components as html
import dash_core_components as dcc
from plotly import graph_objects as go
fig = go.Figure(go.Funnel(
y = ["Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"],
x = [39, 27.4, 20.6, 11, 2]))
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([dcc.Graph(id='FunnelDashboard',
figure=fig)])
if __name__ == '__main__':
app.run_server()
你得到:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.