Skip to content

Toggle select for in legend doesnt work on color label #3627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
henrykeithturner opened this issue Mar 12, 2019 · 1 comment
Closed

Toggle select for in legend doesnt work on color label #3627

henrykeithturner opened this issue Mar 12, 2019 · 1 comment
Assignees
Labels
bug something broken

Comments

@henrykeithturner
Copy link

Hi all,

I initially asked about this on the plotly forum at https://community.plot.ly/t/toggle-select-for-in-legend-doesnt-work-on-color-label/20736, and so now i'm following it up here!

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)

@antoinerg
Copy link
Contributor

antoinerg commented Mar 12, 2019

Thank you @henrykeithturner for the reporting this issue and noticing this annoying behavior. I completely agree that clicking on the symbol should work.

You described the problem really well so I didn't have to try out your example. However, if you ever need to post an example in this repo again, we much prefer having them in a Codepen so we can run it in a browser and make sure the problem is only related to plotly.js the javascript library.

Anyway, thank you again for the clear report 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants