Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
@toyeshhm, thanks for contributing to our project! To help us manage a large volume of pull requests, we do require that you follow our guidelines in The linked issue #7414 doesn't have the To continue:
|
Fixes #7414.
When an axis uses
tickmode: 'array'withtickvalsthat aren't sorted, longticktextlabels can overlap without being auto-angled the way they are when the same values are sorted.Root cause.
arrayTicks()returns the ticks in the order the user gave intickvals.fixLabelOverlaps()indrawLabelsthen assumes neighboring entries are neighbors on the axis: it only testslbbArray[i]againstlbbArray[i + 1], and it takes the tick spacing from(vals[last].x - vals[0].x) / (n - 1). With unsorted values both are wrong, so the chosen angle doesn't match the sorted case (with[3, 0, 5, 1, 4, 2]the spacing comes out tiny and the labels go to 90° instead of 30°, and other orders can miss the overlap entirely).Fix. Sort the ticks by position at the end of
arrayTicks(), beforefilterRangeBreaks. Each tick's text is resolved before the sort, so theticktextpairing is unchanged. Auto-generated ticks are already in axis order, so this makes array ticks match what the rest of the drawing code expects.Test. Added a case in
test/jasmine/tests/axes_test.js(test tickmode calculator > arrayTicks) that plots the same long labels with sorted and unsortedtickvals. It checks that the unsorted axis gets the same_tickAngles.xtick(30°) as the sorted one and that_valscome out in axis order with the right text. Before the fix it fails withExpected 90 to be close to 30; after, it passes.npm run test-jasmine -- axes polar ternary colorbar --nowatchpasses except formore react tests insiderange react to new dataand one@glpolar drag test, which fail the same way onmainlocally.npm run lintandnpm run test-syntaxpass.