Ability to Provide Title to Legend/ Legend Groups
See original GitHub issueI’m 😢 that I can add a heading to the different groups generated by legendgroup
.
I’d like to group my traces by a particular property on the input data, and also display a label.
Imagine data:
[{ 'group': 'A', name: 'thing 1'},
{ 'group': 'A', name: 'thing 2'},
{ 'group': 'B', name: 'thing' }]
If I want the legend to include context about the group, I’d have to prefix the name with the group:
- A: thing 1
- A: thing 2
- B: thing
Whereas if we had the ability to add an overarching legend headings (and for each group) we could do this:
A
- thing 1
- thing 2
B
- thing
you can see where this is an issue with longer group names
Issue Analytics
- State:
- Created 7 years ago
- Reactions:20
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How to add a Legend Title on the newest Excel?
I haven't been able to make a Legend Title on the newest version of Excel (16.35). I went to Chart Design > Add...
Read more >Plotly legend title - python - Stack Overflow
The name property helps in adding custom names to the legends defined. Share.
Read more >Working with legends—ArcMap | Documentation
A legend tells a map reader the meaning of the symbols used to represent features on the map. Legends consist of examples of...
Read more >How to prevent Power BI from listing legend items as a title
Solved: Dear Power BI community: This might seem really obvious but I don't seem to be able to solve it. I have several...
Read more >Do you want DYNAMIC legends in Power BI??? Of ... - YouTube
We wish Power BI had dynamic legends based on selections! Well, Patrick took the challenge and here is a way you can do...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
AFAICT, using absolute positioning annotations doesn’t work if you have legend groups with varying lengths. I have two legend groups of unknown size, so I can’t safely position a label at all times so as to be readable and not misleading. Unfortunately, that makes the legend significantly less useful, since many of the traces are named similarly. Unless there’s a different workaround for this case?
That would be nice!
It won’t be a priority for us though as legend headings can easily be mocked using with properly placed annotations.
That said, it would a great opportunity for a community contributor.
The patch should be in
src/components/legend/draw.js
. Currently the has-legend-group logic is in this block.