Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

legend indentation #6874

Merged
merged 10 commits into from
Feb 27, 2024
Merged

legend indentation #6874

merged 10 commits into from
Feb 27, 2024

Conversation

my-tien
Copy link
Contributor

@my-tien my-tien commented Jan 31, 2024

legend indentation

This PR adds the property indentation to layout.legend so that legend entries can be indented relative to the title.

I have set the min value of this to 0 for now to avoid having to deal with adjusting the legend width and title positioning when the legend extends towards the left.

@@ -105,6 +105,13 @@ module.exports = {
editType: 'legend',
description: 'Determines what entrywidth means.',
},
indentation: {
valType: 'number',
min: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see us allowing negative indentation, to remove or reduce the padding to the left of many of the symbols. Many if not most legend symbols don't use the full itemwidth. The risk here is allowing symbols to bleed off the edge of the legend if you go too far, but I think that's acceptable if you have explicitly set a negative indentation. Maybe min: -15, ie half the minimum itemwidth?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the bleeding off the left edge was my concern as well. I have adapted the test image to showcase how it looks to indent with -15 for a line and a bar legend entry.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, we clip at the edge of the legend, that's perfect.

@archmoj archmoj added feature something new community community contribution status: has TODOs labels Feb 2, 2024
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 Great job @my-tien!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants