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

legendgroup titles

Open nicolaskruchten opened this issue 6 years ago • 8 comments

A new attribute for every trace that supports a legendgroup called legendgrouptitle. The first legendgrouptitle for a given legend group should be used, even if a later one conflicts. This should specify a title that appears above the legend group in the legend.

nicolaskruchten avatar Nov 10 '20 15:11 nicolaskruchten

Some additional notes:

  • legendgrouptitle should be an object that has the same structure as our other title-like objects: keys for text and font (object containing size and color)
  • resolving multiple legendgrouptitle objects for the same group could be just "first one wins" or "merge with a first one wins rule" so that if the title is set in on trace but the font in another, the merged object is used

nicolaskruchten avatar Mar 26 '21 17:03 nicolaskruchten

The default font size for the legend group titles should be slightly smaller than the legend title font size. I actually think that the current default legend font size is too small, as it's often confusable with the legend item text in horizontal orientation, so given that we're in the 2.0 cycle, maybe we bump up the default legend title font size to make this possible, and have the default legend group title font size be the same as the current legend title font size. Feedback welcome.

nicolaskruchten avatar Mar 26 '21 17:03 nicolaskruchten

Should multi-line text and LaTex be supported in the first iteration?

archmoj avatar Mar 29 '21 14:03 archmoj

no :)

nicolaskruchten avatar Mar 29 '21 15:03 nicolaskruchten

I'd like to request that the additional functionality of the legendgrouptitle having the clickable behavior of toggling the whole group, be added along with this feature introduction. This would leave only one more feature to be added, which hopefully can come from a public pull request, if not along with this feature. Which is the ability-

to control whether or not clicking on an item (trace under a legendgroup) in a group toggles only that item or the whole group. This could be a global attribute under layout.legend for example.

As discussed here, https://github.com/plotly/plotly.js/issues/3135#issuecomment-858592557

rithwikjc avatar Jun 12 '21 10:06 rithwikjc

Can you give an example in CodePen please? tried a lot but nothing.. in version 2.3.1 I think. For me legendgrouptitle: {text: "......"} didn't work at all

sakhibgareevrr avatar Aug 17 '21 16:08 sakhibgareevrr

Can you give an example in CodePen please? tried a lot but nothing.. in version 2.3.1 I think. For me legendgrouptitle: {text: "......"} didn't work at all

Here is a codepen.

archmoj avatar Aug 17 '21 16:08 archmoj

Thanks a lot! works now

sakhibgareevrr avatar Aug 17 '21 18:08 sakhibgareevrr