Skip to content

Commit 889087d

Browse files
authored
Merge pull request #3233 from plotly/issue-3224
Bug fix issue 3224 - avoid NaN values for axis dticks by checking ax._length values not to be NaN
2 parents 2009f09 + 8b670e6 commit 889087d

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/plots/gl3d/layout/tick_marks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ function computeTickMarks(scene) {
4747
axes._length = (glRange[i].hi - glRange[i].lo) *
4848
glRange[i].pixelsPerDataUnit / scene.dataScale[i];
4949

50-
if(Math.abs(axes._length) === Infinity) {
50+
if(Math.abs(axes._length) === Infinity ||
51+
isNaN(axes._length)) {
5152
ticks[i] = [];
5253
} else {
5354
axes._input_range = axes.range.slice();

test/jasmine/tests/gl3d_plot_interact_test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,36 @@ describe('Test gl3d plots', function() {
558558
.catch(failTest)
559559
.then(done);
560560
});
561+
562+
it('@gl axis ticks should not be set when axis _length is NaN', function(done) {
563+
Plotly.plot(gd,
564+
{
565+
data: [{
566+
type: 'scatter3d',
567+
mode: 'markers',
568+
x: [1, 2],
569+
y: [3, 4],
570+
z: [5, 6]
571+
}],
572+
layout: {
573+
scene: {
574+
camera: {
575+
eye: {x: 1, y: 1, z: 0},
576+
center: {x: 0.5, y: 0.5, z: 1},
577+
up: {x: 0, y: 0, z: 1}
578+
}
579+
}
580+
}
581+
}
582+
)
583+
.then(function() {
584+
var zaxis = gd._fullLayout.scene.zaxis;
585+
expect(isNaN(zaxis._length)).toBe(true);
586+
expect(zaxis.dtick === undefined).toBe(true);
587+
})
588+
.catch(failTest)
589+
.then(done);
590+
});
561591
});
562592

563593
describe('Test gl3d modebar handlers', function() {

0 commit comments

Comments
 (0)