Reputation: 13
I am trying to display a simple funnel graph using dash and plotly. The problem is that it displays a line graph instead.
I followed the instructions from this answer, that is, used the code:
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()
but am getting this line plot instead.
What I expect to get is something like this.
Upvotes: 1
Views: 405
Reputation: 8933
Update dash:
pip install -U dash
With version 1.9.1
, using this code:
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()
you get:
Upvotes: 1