Skip to content

Commit 33b73ef

Browse files
committed
set blank period positions to axis ends
1 parent 0d5e5a1 commit 33b73ef

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/plots/cartesian/axes.js

+3
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,9 @@ axes.calcTicks = function calcTicks(ax, opts) {
868868
if(p !== undefined) {
869869
t.periodX = p;
870870
if(p > maxRange || p < minRange) { // hide label if outside the range
871+
if(p > maxRange) t.periodX = maxRange;
872+
if(p < minRange) t.periodX = minRange;
873+
871874
t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
872875
ax._prevDateHead = '';
873876
}

test/jasmine/tests/axes_test.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -5267,10 +5267,14 @@ describe('Test axes', function() {
52675267
var ax = gd._fullLayout.xaxis;
52685268

52695269
var positions = ax._vals.map(function(d) { return ax.c2d(d.periodX !== undefined ? d.periodX : d.x); });
5270-
expect(positions).withContext(msg).toEqual(expPositions);
5271-
52725270
var labels = ax._vals.map(function(d) { return d.text; });
5273-
expect(labels).withContext(msg).toEqual(expLabels);
5271+
5272+
for(var i = 0; i < labels.length; i++) {
5273+
expect(labels[i]).withContext(msg).toBe(expLabels[i]);
5274+
if(labels[i] !== ' ') {
5275+
expect(positions[i]).withContext(msg).toBe(expPositions[i]);
5276+
}
5277+
}
52745278
}
52755279

52765280
['%Y', '%y'].forEach(function(formatter, i) {

0 commit comments

Comments
 (0)