Skip to content
1 change: 1 addition & 0 deletions draftlogs/7935_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix tick label format sometimes being incompatible with the labeled tick when using `ticklabelindex` [[#7935](https://github.com/plotly/plotly.js/pull/7935)], with thanks to @my-tien for the contribution!
8 changes: 7 additions & 1 deletion src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ axes.prepMinorTicks = function(mockAx, ax, opts) {
// ensure identical tick0
mockAx.tick0 = ax.tick0;
}
if (ax._useTicklabelIndex) {
// this could always be done but the additional information on the minor
// axis is just necessary when using ticklabelindex.
autoTickRound(mockAx);
ax.minor._tickround = mockAx._tickround;
}
};

function isMultiple(bigger, smaller) {
Expand Down Expand Up @@ -1962,7 +1968,7 @@ function tickTextObj(ax, x, text) {
}

function formatDate(ax, out, hover, extraPrecision) {
var tr = ax._tickround;
var tr = ax._useTicklabelIndex ? ax.minor._tickround : ax._tickround;
var fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax);

// Only apply extra precision if no explicit format was provided.
Expand Down
Binary file modified 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.
2 changes: 1 addition & 1 deletion test/image/mocks/date_axes_period2_ticklabelindex.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"layout": {
"showlegend": false,
"width": 600,
"height": 500,
"height": 740,
"yaxis": {
"domain": [0, 0.04]
},
Expand Down
Loading