Toggle select for in legend doesnt work on color label

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)

Hi @henry.k.turner,

That sounds like a reasonable idea :slight_smile: Feel free to open an issue with the plotly.js project to discuss https://github.com/plotly/plotly.js/issues.

-Jon

Hi @jmmease

Sure thing, will do!

Thanks!

Harry