`alignmentgroup` & `offsetgroup` restyle bug
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
@archmoj this looks great! There's one piece I don't understand: if I load `zz-scatter-grouping-vs-defaults`, then clear all the `alignmentgroup` attrs - `Plotly.restyle(gd,'alignmentgroup',null)` - then the traces in the upper right subplot disappear. They also disappear if I set the `alignmentgroup` for just those two traces to `'bottom'` to match the ones below - `Plotly.restyle(gd,'alignmentgroup','bottom', [3,9])`.
If I also clear offsetgroup they come back, and if I set the offsetgroup for those two to something explicit they get their own group.
So I guess the odd case is when alignmentgroup is either all null or all the same but one trace, in a different subplot from the others, doesn't have an offsetgroup.
There's a related case that's clearly broken: in the same mock, if I just clear offsetgroup for the last trace it stays where it was. But if I first give it a new offsetgroup (so it correctly gets new space) and THEN clear it, it gets pushed into the next group!
Plotly.restyle(gd, 'offsetgroup', null, 11) // clear the group for the last trace, this is OK
Plotly.restyle(gd, 'offsetgroup', '3', 11) // put it in a new group
Plotly.restyle(gd, 'offsetgroup', null, 11) // clear its group
I don't think this is unique to scatter, I can get a similar history-dependent errors from bars from setting / clearing the offsetgroup of the FIRST bar in the bottom right subplot (ie replace the 11 with 4 in those commands). Maybe we just treat null as its own offsetgroup if there are other traces with an offsetgroup on the same axis?
Originally posted by @alexcjohnson in https://github.com/plotly/plotly.js/issues/6381#issuecomment-1360562317
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the zz-scatter-grouping-vs-defaults mock using the described Plotly.restyle calls for alignmentgroup and offsetgroup, including both clearing and assigning groups. Trace the grouping behavior from those entry points. Done means clearing or changing groups does not make traces disappear, push them into another group, or depend on the order of restyles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100