Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

legendgroup titles #5260

Closed
nicolaskruchten opened this issue Nov 10, 2020 · 8 comments · Fixed by #5752
Closed

legendgroup titles #5260

nicolaskruchten opened this issue Nov 10, 2020 · 8 comments · Fixed by #5752
Labels
feature something new
Milestone

Comments

@nicolaskruchten
Copy link
Contributor

nicolaskruchten commented Nov 10, 2020

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@archmoj
Copy link
Contributor

archmoj commented Mar 29, 2021

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

@nicolaskruchten
Copy link
Contributor Author

no :)

@rithwikjc
Copy link

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

@sakhibgareevrr
Copy link

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

@archmoj
Copy link
Contributor

archmoj commented Aug 17, 2021

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.

@sakhibgareevrr
Copy link

Thanks a lot! works now

mrtnbrst added a commit to mrtnbrst/DefinitelyTyped that referenced this issue Jun 29, 2023
Added missing properties of PlotData

legendgrouptitle: plotly/plotly.js#5260

Plotly attributes file with legendgrouptitle and legendrank right below:
https://github.com/plotly/plotly.js/blob/ab5e16afc34fa4f22efffef129f811381580e0fe/src/plots/attributes.js#L57
typescript-bot pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Jul 9, 2023
* Add legendgrouptitle and legendrank to PlotData

Added missing properties of PlotData

legendgrouptitle: plotly/plotly.js#5260

Plotly attributes file with legendgrouptitle and legendrank right below:
https://github.com/plotly/plotly.js/blob/ab5e16afc34fa4f22efffef129f811381580e0fe/src/plots/attributes.js#L57

* fix wrong legendgrouptitle type

* style: run prettier in package with config from repo
typescript-bot pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Jul 13, 2023
* Add legendgrouptitle and legendrank to PlotData

Added missing properties of PlotData

legendgrouptitle: plotly/plotly.js#5260

Plotly attributes file with legendgrouptitle and legendrank right below:
https://github.com/plotly/plotly.js/blob/ab5e16afc34fa4f22efffef129f811381580e0fe/src/plots/attributes.js#L57

* fix wrong legendgrouptitle type

* style: run prettier in package with config from repo

* feat: add uid at several locations, add uirevision once

* chore: remove myself from code owners
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants