我正在尝试使用dash和plotly显示一个简单的漏斗图。问题是它显示的是折线图。
我遵循了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()但是我得到的是this线条图。
我期望得到的是类似于this的东西。
发布于 2020-03-02 23:27:22
更新破折号:
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()你会得到:

https://stackoverflow.com/questions/60485469
复制相似问题