Skip to content

Ticklabelindex fixes for issues #7875 and #7876#7877

Open
my-tien wants to merge 11 commits into
plotly:masterfrom
my-tien:7875-7876-ticklabelindex-fixes
Open

Ticklabelindex fixes for issues #7875 and #7876#7877
my-tien wants to merge 11 commits into
plotly:masterfrom
my-tien:7875-7876-ticklabelindex-fixes

Conversation

@my-tien

@my-tien my-tien commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #7876 by rewriting the way period label positioning works when using ticklabelindex. Previously, the next labeled tick was used as the period end for the previous tick. Now positionPeriodTicks can accept an array of periodEndTicks instead,

Fixes #7875 by adding an additional major tick at the end of the axis range + all minor ticks between the last visible tick and that helper.
Previously, there was already code that added one major tick and one minor tick before tick0. Now the behavior is symmetrical to the axis range end (1 major tick and all minor ticks between that and tick0).
We need all minor ticks between the first/last visible tick and the major helper tick so that walking ticklabelindex steps from that helper tick lands on the correct minor tick.

my-tien added 11 commits June 29, 2026 14:28
If ticklabelIndex was set, calcMinor was set to its value instead of being set to true. This didn't cause a bug but calcMinor is expected to be a boolean.
The previous name "text" is a little confusing since the return value is later used as a tick in calcTicks.
Also, don't just add one minor tick but as many as there should be between two major ticks.

This is part of the fix for the last period label sometimes not being visible if ticklabelindex is negative.

We need all minor ticks between the last visible tick and the major helper tick so that going back ticklabelindex steps from that helper tick lands on the correct minor tick.
Now uses an array "periodEndTicks" that contains the ending tick for each starting tick of a labeled period to determine label positioning.
Simplify code. labelIndex > 0 and labelIndex === 0 are actually treated in the same way.
- Fix description of lower plot.
- Fix missing trailing newline.
There are only minimal pixel differences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant