Hi all,
Iâve noticed a minor issue when you have a chart with a legend, that if you want to remove a particular trace then you can click either on the word in the legend or to the left of the accompanying coloured square. If you click on the coloured square itself then nothing happens, which seems counter intuitive since (when using bar charts) the square coloured box looks like a button which youâre suppose to click (and i keep finding people instinctively try to click that first to toggle on a particular trace).
Iâve attached an example where you can see that clicking on the square coloured boxes in the legend does nothing, but clicking on the word does.
For the bar chart case this seems to be because the âlegendbarâ element is in front of the âlegendtoggleâ index.
Can this behaviour be changed, because itâs causing a bit of confusion with people instinctively trying to click the coloured box first to switch off traces?
Many Thanks!
Harry
from plotly import version
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
trace1 = go.Bar(
x=[âgiraffesâ, âorangutansâ, âmonkeysâ],
y=[20, 14, 23],
name=âSF Zooâ
)
trace2 = go.Bar(
x=[âgiraffesâ, âorangutansâ, âmonkeysâ],
y=[12, 18, 29],
name=âLA Zooâ
)
data = [trace1, trace2]
layout = go.Layout(
barmode=âgroupâ
)
trace1 = go.Bar(
x=[âgiraffesâ, âorangutansâ, âmonkeysâ],
y=[20, 14, 23],
name=âSF Zooâ
)
trace2 = go.Bar(
x=[âgiraffesâ, âorangutansâ, âmonkeysâ],
y=[12, 18, 29],
name=âLA Zooâ
)
data = [trace1, trace2]
layout = go.Layout(
barmode=âstackâ
)
fig = py.graph_objs.Figure(data=data, layout=layout)
py.offline.iplot(fig)