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

Enable custom legend box heights #7459

Merged
merged 7 commits into from
Jun 4, 2020
Merged

Conversation

etimberg
Copy link
Member

@etimberg etimberg commented Jun 4, 2020

Adds a new option options.legend.labels.boxHeight which can be used to set the legend box height. Resolves #2051

This could lead to some alignment options in the future to control where low height boxes are drawn (currently this is in the center) or where text is drawn when the box is taller than the font size (this is also the center).

Large Height

options.legend.labels.boxHeight == 100

tall box

Small Height

options.legend.labels.boxHeight == 5

short box

Line Appearance

options.legend.labels.boxHeight == 1

line style

Copy link
Member

@kurkle kurkle left a comment

Choose a reason for hiding this comment

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

Couple of comments

src/plugins/plugin.legend.js Outdated Show resolved Hide resolved
src/plugins/plugin.legend.js Outdated Show resolved Hide resolved
@kurkle
Copy link
Member

kurkle commented Jun 4, 2020

That last image with boxHeight = 1 looks high, it has borders?

kurkle
kurkle previously approved these changes Jun 4, 2020
Copy link
Member

@kurkle kurkle left a comment

Choose a reason for hiding this comment

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

some nits

src/plugins/plugin.legend.js Outdated Show resolved Hide resolved
src/plugins/plugin.legend.js Show resolved Hide resolved
@etimberg etimberg merged commit 0703d78 into chartjs:master Jun 4, 2020
@etimberg etimberg deleted the legend-box-height branch June 4, 2020 23:53
@etimberg etimberg added this to the Version 3.0 milestone Jun 4, 2020
etimberg added a commit that referenced this pull request Sep 1, 2020
Enable custom legend box heights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customize legend box height
3 participants