plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

legend.grouporientation

Open nicolaskruchten opened this issue 4 years ago • 7 comments
trafficstars

Right now, legend items in legend groups always stack vertically, and then the groups themselves are laid out per legend.orientation. We need a new legend.grouporientation attribute that will cause the items within a group to lay themselves out left-to-right.

nicolaskruchten avatar Apr 06 '21 14:04 nicolaskruchten

Case of legend.grouporientation: 'h' when legend.orientation: 'h' is out of scope of this issue. Right?

archmoj avatar Apr 06 '21 17:04 archmoj

I was sort of assuming we would support all four combinations... any reason not to?

nicolaskruchten avatar Apr 06 '21 17:04 nicolaskruchten

@archmoj and I were discussing the h/h case this morning - what would it look like? Would it wrap somehow (within groups? only between groups? only within a group if it also wraps both before and after that group?) or only support a single line? Where would we put group gaps and group titles? I suppose we could think up answers to these but I suspect they'll be quite a bit more complex than the one new and two existing cases, and I'm not sure when you'd want to use it. So my inclination would be to only enable grouporientation='h' when orientation='v' for now (along with the two existing cases, which correspond to grouporientation='v' with either value of orientation, right?)

alexcjohnson avatar Apr 06 '21 20:04 alexcjohnson

OK, let's start with coercing grouporientation=v if orientation=h for now and revisit later.

nicolaskruchten avatar Apr 07 '21 00:04 nicolaskruchten

Clarification: legend.orientation here essentially defines the relationship between groups i.e. "v" means "groups stack vertically" and "h" means "groups are laid out horizontally and wrap". This is the current state of affairs if you assume that each trace is in its own group (which might not quiiite be right but close enough).

legend.grouporientation then will define the relationship between traces in a group which today is always "v" and we want to enable "h".

nicolaskruchten avatar Jun 22 '21 16:06 nicolaskruchten

What about renaming the attribute to something like legend.groupenter or legend.groupspace? Then we could use numbers/enums like true/false or <b> for enter and blank as well as single/multiple spaces.

archmoj avatar Jun 22 '21 16:06 archmoj

For example: groupspacing : 0 (or -1) could be used to enter new items to the group and it could be set to e.g. 24 (px) to enter the items on the same line.

archmoj avatar Jun 22 '21 17:06 archmoj