pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/chartjs/Chart.js/pull/12244

ll" rel="stylesheet" href="https://github.githubassets.com/assets/pull-requests-be6017ec12798e73.css" /> fix: keep reversed scale titles aligned by d3v07 · Pull Request #12244 · chartjs/Chart.js · GitHub
Skip to content

fix: keep reversed scale titles aligned - #12244

Open
d3v07 wants to merge 2 commits into
chartjs:masterfrom
d3v07:fix/12239-reversed-scale-title-align
Open

fix: keep reversed scale titles aligned#12244
d3v07 wants to merge 2 commits into
chartjs:masterfrom
d3v07:fix/12239-reversed-scale-title-align

Conversation

@d3v07

@d3v07 d3v07 commented Apr 22, 2026

Copy link
Copy Markdown

Summary

  • stop reversed scales from flipping title text alignment to the opposite end
  • add a regression test covering align: 'start' and align: 'end' across cartesian scale positions

Fixes #12239

Repro

Verification

  • pnpm run build
  • pnpm exec eslint src/core/core.scale.js test/specs/core.scale.tests.js
  • local browser repro confirming reverse no longer changes the title draw calls for align=start or align=end

Copilot AI review requested due to automatic review settings April 22, 2026 16:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes axis title alignment so reversing a cartesian scale no longer flips title.align (“start”/“end”) to the opposite end, and adds a regression test for the behavior.

Changes:

  • Update internal titleAlign logic so reverse no longer influences title text alignment.
  • Add regression tests asserting title draw calls are identical for reverse: true vs reverse: false across cartesian edge positions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/core/core.scale.js Removes reverse from title alignment calculation to keep start/end alignment stable when scales are reversed.
test/specs/core.scale.tests.js Adds a regression test comparing captured title draw calls between reversed and non-reversed scales for align: 'start'/'end'.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/core.scale.js Outdated
Comment on lines 122 to 127
function titleAlign(align, position) {
/** @type {CanvasTextAlign} */
let ret = _toLeftRightCenter(align);
if ((reverse && position !== 'right') || (!reverse && position === 'right')) {
if (position === 'right') {
ret = reverseAlign(ret);
}
Comment thread test/specs/core.scale.tests.js Outdated
Comment on lines +890 to +893
['top', 'bottom', 'left', 'right'].forEach(function(position) {
['start', 'end'].forEach(function(align) {
it('should not reposition the ' + position + ' scale title when reverse=true and align=' + align, function() {
expect(getScaleTitleCalls(position, align, true)).toEqual(getScaleTitleCalls(position, align, false));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Axis titles are misaligned when the scale is reversed

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy