question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to Provide Title to Legend/ Legend Groups

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Reactions:20
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
seansfkelleycommented, Aug 30, 2018

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?

3reactions
etpinardcommented, Jul 8, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found