-
Notifications
You must be signed in to change notification settings - Fork 12k
Fix : Scale label display at top and right. #3741
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
Conversation
1.Rotation of scale label when scale is right. 2.Scale position at rotation when scale is top.
etimberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my comment on the vertical label, I think this looks good. Not sure if there is a way to write a test for this or not
src/core/core.scale.js
Outdated
| scaleLabelX = isLeft ? me.left + (scaleLabelFont.size / 2) : me.right - (scaleLabelFont.size / 2); | ||
| scaleLabelY = me.top + ((me.bottom - me.top) / 2); | ||
| rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI; | ||
| rotation = -0.5 * Math.PI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this change. I, personally, find it easier to read in the current orientation on the right side. CC @chartjs/maintainers thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also consistent with the label on the left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I wrote it the current way is that to me it felt more natural to turn my head to the right on the right side and to the left on the left side.
I don't know what most chart packages do though. If everyone else has the proposed rotation then we can change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the old version is better, and the labels should have their bottom along the side of the chart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for considering it. I will cancel this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @KoyoSE
Fix Scale position at rotation when scale is top.


The following problem was solved.
1.Rotation of scale label when scale is right
2.Scale position at rotation when scale is top.
Before
jsFiddle
After
jsFiddle