Skip to content

fix: Format date tick labels with minor-tick precision when using ticklabelindex - #7935

Open
my-tien wants to merge 10 commits into
plotly:mainfrom
my-tien:7933-minor-ticklabel-format
Open

my-tien wants to merge 10 commits into
plotly:mainfrom
my-tien:7933-minor-ticklabel-format

Conversation

@my-tien

@my-tien my-tien commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Fix #7933 by determining the tick format using the rounded ticks of the minor axis instead of the major axis when ticklabelindex is set.

Stacks on top of #7934.

@my-tien
my-tien force-pushed the 7933-minor-ticklabel-format branch from b701674 to 77d7d26 Compare August 5, 2026 14:50
@robertclaus
robertclaus requested a review from camdecoster August 6, 2026 19:33
@camdecoster camdecoster changed the title 7933 minor ticklabel format fix: Format date tick labels with minor-tick precision when using ticklabelindex Sep 24, 2026
Comment thread draftlogs/7935_fix.md
@@ -0,0 +1 @@
- Fix tick label format sometimes being incompatible with the labeled tick when using ticklabelindex [[#7934](https://github.com/plotly/plotly.js/pull/7935)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Fix tick label format sometimes being incompatible with the labeled tick when using ticklabelindex [[#7934](https://github.com/plotly/plotly.js/pull/7935)]
- Fix tick label format sometimes being incompatible with the labeled tick when using ticklabelindex [[#7935](https://github.com/plotly/plotly.js/pull/7935)]

var fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax);

var tr = ax._useTicklabelIndex ? ax.minor._tickround : ax._tickround;
var fmt = ax._useTicklabelIndex ? "" : (hover && ax.hoverformat) || axes.getTickFormat(ax);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you use an empty string for a ticklabelindex? This ignores hoverformat and could erase a user specified tick format.

// axis is just necessary when using ticklabelindex.
autoTickRound(mockAx);
delete mockAx.minor; // prevent self-reference
Lib.extendFlat(ax.minor, mockAx);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What are you trying to copy over on this line? I think it might be better to save the specific keys you're looking for than adding the entirety of mockAx.

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.

[BUG]: tickformat doesn't adjust when labels are positioned below minor ticks (because of ticklabelindex)

2 participants