Skip to content

Commit 245a9c3

Browse files
committed
When using ticklabelindex, make sure tick labels use formatting compatible with minor ticks.
E.g. if major ticks are daily and minor ticks are hourly, tick labels on minor ticks should include hourly information.
1 parent 65dbb62 commit 245a9c3

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎src/plots/cartesian/axes.js‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,13 @@ axes.prepMinorTicks = function(mockAx, ax, opts) {
716716
// ensure identical tick0
717717
mockAx.tick0 = ax.tick0;
718718
}
719+
if (ax._useTicklabelIndex) {
720+
// this could always be done but the additional information on the minor
721+
// axis is just necessary when using ticklabelindex.
722+
autoTickRound(mockAx);
723+
delete mockAx.minor; // prevent self-reference
724+
Lib.extendFlat(ax.minor, mockAx);
725+
}
719726
};
720727

721728
function isMultiple(bigger, smaller) {
@@ -1926,9 +1933,9 @@ function tickTextObj(ax, x, text) {
19261933
}
19271934

19281935
function formatDate(ax, out, hover, extraPrecision) {
1929-
var tr = ax._tickround;
1930-
var fmt = (hover && ax.hoverformat) || axes.getTickFormat(ax);
1931-
1936+
var periodAxis = ax._useTicklabelIndex ? ax.minor : ax;
1937+
var tr = periodAxis._tickround;
1938+
var fmt = (hover && ax.hoverformat) || axes.getTickFormat(periodAxis);
19321939
// Only apply extra precision if no explicit format was provided.
19331940
extraPrecision = !fmt && extraPrecision;
19341941

0 commit comments

Comments
 (0)