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

Add label alignment option to axis label title #6521

Merged
merged 11 commits into from
Oct 27, 2019
Merged

Add label alignment option to axis label title #6521

merged 11 commits into from
Oct 27, 2019

Conversation

el
Copy link
Contributor

@el el commented Sep 15, 2019

Change in action: https://codepen.io/elizzk/pen/PoYBRWX

Closes: #6515

@benmccann
Copy link
Contributor

@el the build is failing. Please make sure gulp lint works

docs/axes/labelling.md Outdated Show resolved Hide resolved
@kurkle
Copy link
Member

kurkle commented Sep 16, 2019

Is start at top for right scale ok? The numbers (that are not drawn for right axis in master btw!) start from bottom unless reversed.

@el
Copy link
Contributor Author

el commented Sep 16, 2019

Is start at top for right scale ok? The numbers (that are not drawn for right axis in master btw!) start from bottom unless reversed.

I wasn't thinking the scale start for start. It is the start of the label. (I didn't want to use left/right/top/bottom)

@etimberg
Copy link
Member

I think we should consider the start point the same for left or right axes. As @kurkle mentioned, this should respect the reverse setting though for both orientations

@el
Copy link
Contributor Author

el commented Sep 17, 2019

I think we should consider the start point the same for left or right axes. As @kurkle mentioned, this should respect the reverse setting though for both orientations

What if all the data is negative? Then the axis start would be the top. Or if the data have negative and positive values, then the start would in the middle.

@kurkle
Copy link
Member

kurkle commented Sep 18, 2019

What if all the data is negative? Then the axis start would be the top. Or if the data have negative and positive values, then the start would in the middle.

Start (lowest value) will still be at bottom, unless reverse is set. I'd consider scale start be same as first tick.

@el
Copy link
Contributor Author

el commented Sep 19, 2019

Updated codepen with start at bottom on right axis, and reverse support:

https://codepen.io/elizzk/pen/PoYBRWX?editors=1010

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.

Other than reverse for horizontal scales, looks good to me.

src/core/core.scale.js Outdated Show resolved Hide resolved
kurkle
kurkle previously approved these changes Sep 19, 2019
docs/axes/labelling.md Outdated Show resolved Hide resolved
src/core/core.scale.js Outdated Show resolved Hide resolved
etimberg
etimberg previously approved these changes Oct 5, 2019
Copy link
Contributor

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

looks good. just a couple minor comments

src/core/core.scale.js Show resolved Hide resolved
src/core/core.scale.js Outdated Show resolved Hide resolved
@el el dismissed stale reviews from AlexanderChechyotko and etimberg via b5c2d2f October 7, 2019 12:40
benmccann
benmccann previously approved these changes Oct 7, 2019
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.

reverse is not working correctly for horizontal scales.

src/core/core.scale.js Outdated Show resolved Hide resolved
src/core/core.scale.js Outdated Show resolved Hide resolved
@el
Copy link
Contributor Author

el commented Oct 18, 2019

So, I have created this page to test all possible variations:

https://codepen.io/elizzk/pen/PoYBRWX?editors=0010

Right now there is an issue with horizontal scales.

I will push pushed an update. If you know any other variation that can effect this, please let me know.

@el
Copy link
Contributor Author

el commented Oct 25, 2019

Do we need any other changes for this? @kurkle @benmccann @etimberg

@etimberg etimberg added this to the Version 3.0 milestone Oct 27, 2019
@etimberg etimberg merged commit 17655c7 into chartjs:master Oct 27, 2019
@makivlach
Copy link

makivlach commented Nov 24, 2020

I would love if there was an option to put the axis label at the top (if it was Y-axis; like so)

link to the issue on StackOverflow: https://stackoverflow.com/questions/53797324/chartjs-align-axis-label-to-the-top
image

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.

Ability to left align axis labels
6 participants