Skip to content

Add label alignment option to axis label title#6521

Merged
etimberg merged 11 commits into
chartjs:masterfrom
el:master
Oct 27, 2019
Merged

Add label alignment option to axis label title#6521
etimberg merged 11 commits into
chartjs:masterfrom
el:master

Conversation

@el

@el el commented Sep 15, 2019

Copy link
Copy Markdown
Contributor

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

Closes: #6515

@benmccann

Copy link
Copy Markdown
Contributor

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

Comment thread docs/axes/labelling.md Outdated
@kurkle

kurkle commented Sep 16, 2019

Copy link
Copy Markdown
Member

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

el commented Sep 16, 2019

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

el commented Sep 17, 2019

Copy link
Copy Markdown
Contributor Author

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

kurkle commented Sep 18, 2019

Copy link
Copy Markdown
Member

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

el commented Sep 19, 2019

Copy link
Copy Markdown
Contributor Author

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

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

@kurkle kurkle left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/core/core.scale.js Outdated
kurkle
kurkle previously approved these changes Sep 19, 2019
Comment thread docs/axes/labelling.md Outdated
Comment thread src/core/core.scale.js Outdated
etimberg
etimberg previously approved these changes Oct 5, 2019

@benmccann benmccann left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/core/core.scale.js
Comment thread src/core/core.scale.js Outdated
@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

@kurkle kurkle left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/core/core.scale.js Outdated
Comment thread src/core/core.scale.js Outdated
@el

el commented Oct 18, 2019

Copy link
Copy Markdown
Contributor Author

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

el commented Oct 25, 2019

Copy link
Copy Markdown
Contributor Author

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

makivlach commented Nov 24, 2020

Copy link
Copy Markdown

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