Repository navigation
fix: Center period labels over their own period when using ticklabelindex #7934
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
Merged
camdecoster
merged 17 commits into
plotly:main
from
my-tien:7876-ticklabelindex-positioning
Oct 7, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5047961
Add flag useTicklabelIndex
my-tien c59fa9f
Make sure period labels are not positioned below a different period.
my-tien 9fbd6c4
Mock ticklabelindex-2 to test correct ticklabel placement
my-tien b12f71a
Add draftlog for PR 7934
my-tien c1ecb06
Add missing replacements of ticklabelindex with ax._useTicklabelIndex
my-tien 65dbb62
Baseline images for ticklabelindex-2 and date_axes_period2_ticklabeli…
my-tien a84c7c1
replace toSorted with sort
my-tien 029825b
Store periodEndTick directly in ticks that are passed to positionPeri…
my-tien 9b71462
Simplify setting of majorTick.skipLabel
my-tien 5a8a7d2
Fix access to periodEndTick.value in positionPeriodTicks.
my-tien 0ff997f
Make sure last label isn't dropped on period axis with ticklabelindex
my-tien 93baa6e
Fix ticklabelindex positioning if major and minor ticks aren't aligned.
my-tien dfd52ab
Replace some `var` with better scoped `let` and `const` in ticklabeli…
my-tien b4d49bd
Fix ticklabelindex label positioning for minor periods < 1 day
my-tien acad36d
Update baseline images after fixing ticklabelindex label positioning …
my-tien 7cefdcb
Update formatting, comment, small refactor
camdecoster e520e67
Update draftlog
camdecoster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Fix incorrect positioning of tick labels when using `ticklabelindex` on period axes [[#7934](https://github.com/plotly/plotly.js/pull/7934)], with thanks to @my-tien for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+361 Bytes
(100%)
test/image/baselines/date_axes_period2_ticklabelindex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "data": [ | ||
| { | ||
| "mode": "markers+text", | ||
| "texttemplate": "%{x|Q%q %y}", | ||
| "textposition": "top center", | ||
| "x": [ | ||
| "2019-07-01", "2019-10-01", "2020-01-01", "2020-04-01", "2020-07-01" | ||
| ], | ||
| "y": [ | ||
| 2, 2, 2, 2, 2 | ||
| ] | ||
| } | ||
| ], | ||
| "layout": { | ||
| "width": 600, | ||
| "height": 400, | ||
| "xaxis": { | ||
| "dtick": "M24", | ||
| "insiderange": [ | ||
| "2019-03-01", | ||
| "2021-01-01" | ||
| ], | ||
| "tick0": "2021-01-01", | ||
| "tickformat": "%Y", | ||
| "ticklabelindex": -1, | ||
| "ticklabelmode": "period", | ||
| "ticklen": 20, | ||
| "type": "date", | ||
| "ticks": "outside", | ||
| "minor": { "dtick": "M12" }, | ||
| "title": { | ||
| "text": "Should display 1 major tick and a label 2020." | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.