Skip to content

Commit 77a51d3

Browse files
committed
move the logic above firstTick so that we know ax.dtick by that time
1 parent 5d61cef commit 77a51d3

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/plots/cartesian/axes.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -613,19 +613,6 @@ axes.calcTicks = function calcTicks(ax, opts) {
613613
var minRange = Math.min(rng[0], rng[1]);
614614
var maxRange = Math.max(rng[0], rng[1]);
615615

616-
// find the first tick
617-
ax._tmin = axes.tickFirst(ax, opts);
618-
619-
// No visible ticks? Quit.
620-
// I've only seen this on category axes with all categories off the edge.
621-
if((ax._tmin < startTick) !== axrev) return [];
622-
623-
// return the full set of tick vals
624-
if(ax.type === 'category' || ax.type === 'multicategory') {
625-
endTick = (axrev) ? Math.max(-0.5, endTick) :
626-
Math.min(ax._categories.length - 0.5, endTick);
627-
}
628-
629616
var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
630617
var isMDate = (ax.type === 'date') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'M');
631618

@@ -708,6 +695,19 @@ axes.calcTicks = function calcTicks(ax, opts) {
708695
}
709696
}
710697

698+
// find the first tick
699+
ax._tmin = axes.tickFirst(ax, opts);
700+
701+
// No visible ticks? Quit.
702+
// I've only seen this on category axes with all categories off the edge.
703+
if((ax._tmin < startTick) !== axrev) return [];
704+
705+
// return the full set of tick vals
706+
if(ax.type === 'category' || ax.type === 'multicategory') {
707+
endTick = (axrev) ? Math.max(-0.5, endTick) :
708+
Math.min(ax._categories.length - 0.5, endTick);
709+
}
710+
711711
var x = ax._tmin;
712712

713713
if(ax.rangebreaks && ax._tick0Init !== ax.tick0) {

test/jasmine/tests/axes_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5684,17 +5684,17 @@ describe('Test axes', function() {
56845684
[
56855685
{
56865686
range: ['2019-12-10', '2020-01-10'],
5687-
positions: ['2019-12-16 12:00', '2020-01-10'],
5687+
positions: ['2019-12-17 12:00', '2020-01-10'],
56885688
labels: ['2019-Dec', ' ']
56895689
},
56905690
{
56915691
range: ['2019-12-20', '2020-01-20'],
5692-
positions: ['2019-12-20', '2020-01-16 12:00'],
5692+
positions: ['2019-12-20', '2020-01-17 12:00'],
56935693
labels: [' ', '2020-Jan']
56945694
},
56955695
{
56965696
range: ['2020-01-20', '2019-12-20'],
5697-
positions: ['2020-01-20', '2020-01-16 12:00'],
5697+
positions: ['2020-01-20', '2020-01-17 12:00'],
56985698
labels: [' ', '2020-Jan']
56995699
}
57005700
].forEach(function(t) {

0 commit comments

Comments
 (0)