Skip to content

Commit 8050b27

Browse files
authored
Merge pull request #5909 from plotly/toggleitem-groupclick
Fix double click legends when groupclick is set to toggleitem
2 parents 8152107 + b08f108 commit 8050b27

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

draftlogs/#5909_fix.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix double click legends when `groupclick` is set to "toggleitem" [[#5909](https://github.com/plotly/plotly.js/pull/5909)]

src/components/legend/handle_click.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ module.exports = function handleClick(g, gd, numClicks) {
6565
}
6666

6767
function setVisibility(fullTrace, visibility) {
68+
if(legendItem.groupTitle && !toggleGroup) return;
69+
6870
var fullInput = fullTrace._fullInput;
6971
if(Registry.hasTransform(fullInput, 'groupby')) {
7072
var kcont = carrs[fullInput.index];
@@ -199,7 +201,7 @@ module.exports = function handleClick(g, gd, numClicks) {
199201
// N.B. consider traces that have a set legendgroup as toggleable
200202
notInLegend = (fullData[i].showlegend !== true && !fullData[i].legendgroup);
201203
isInGroup = isClicked || (hasLegendgroup && fullData[i].legendgroup === legendgroup);
202-
setVisibility(fullData[i], ((isInGroup && toggleGroup) || notInLegend) ? true : otherState);
204+
setVisibility(fullData[i], (isInGroup || notInLegend) ? true : otherState);
203205
break;
204206
}
205207
}

0 commit comments

Comments
 (0)