Plotly-Dash 显示错误的图表(线图而不是漏斗图)

Plotly-Dash displays the wrong graph (line plot instead of funnel)

我正在尝试使用 dash 和 plotly 显示一个简单的漏斗图。问题是它显示的是折线图。

我按照答案的说明,即使用了代码:

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()

但我得到的是 this 线图。

我希望得到的是 this。

更新破折号:

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()

你得到: