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 #6381 (comment)