Aaron
1
Hi,
I want to build a funnel chart, like this (works fine in jupyter)
But it is not working. Can anybody help?
from plotly import graph_objects as go
y = ['Innovation', 'Kommunikation & Empowerment', 'Gesundheit und Sicherheit']
x = [2.29, 1.76, 4.72]
fig = go.Figure(go.Funnel(y=y, x = x, dy = 0, opacity = 0.75, width=1, text = y,
marker = {"color": ["#C901A1", "#007FBD", "turquoise",], "line": {"width": False}},
connector = {"visible": False, }))
fig.update_layout( font_size=12, paper_bgcolor='White', plot_bgcolor='White',
yaxis={'visible': False, 'showticklabels': False})
self.chart.figure = fig
stucork
2
The client side go.Figure
implementation is incomplete
So there are two approaches that work well
-
create the figure on the server and return it to the client
-
avoid using go.Figure
on the client, and adjust your code as follows:
y = ['Innovation', 'Kommunikation & Empowerment', 'Gesundheit und Sicherheit']
x = [2.29, 1.76, 4.72]
self.plot_1.data = go.Funnel(y=y, x = x, dy = 0, opacity = 0.75, width=1, text = y,
marker = {"color": ["#C901A1", "#007FBD", "turquoise",], "line": {"width": False}},
connector = {"visible": False, })
self.plot_1.layout = go.Layout(font_size=12, paper_bgcolor='White', plot_bgcolor='White', yaxis={'visible': False, 'showticklabels': False})
Aaron
3
Thank you Stu, thats great - when I test it, it is fine.
When I put it in my app, I get a weird look: