Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix issue 3224 - avoid NaN values for axis dticks #3233

Merged
merged 7 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/plots/gl3d/layout/tick_marks.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ function computeTickMarks(scene) {
axes._length = (glRange[i].hi - glRange[i].lo) *
glRange[i].pixelsPerDataUnit / scene.dataScale[i];

if(Math.abs(axes._length) === Infinity) {
if(Math.abs(axes._length) === Infinity ||
Math.abs(axes._length) === -Infinity ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, how can Math.abs(...) === -Infinity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note. Just removed that line.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Anyway much better to fix the issue here than in axes.js!

💃

isNaN(axes._length)) {
ticks[i] = [];
} else {
axes._input_range = axes.range.slice();
Expand Down
30 changes: 30 additions & 0 deletions test/jasmine/tests/gl3d_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,36 @@ describe('Test gl3d plots', function() {
.catch(failTest)
.then(done);
});

it('@gl axis ticks should not be set when axis _length is NaN', function(done) {
Plotly.plot(gd,
{
data: [{
type: 'scatter3d',
mode: 'markers',
x: [1, 2],
y: [3, 4],
z: [5, 6]
}],
layout: {
scene: {
camera: {
eye: {x: 1, y: 1, z: 0},
center: {x: 0.5, y: 0.5, z: 1},
up: {x: 0, y: 0, z: 1}
}
}
}
}
)
.then(function() {
var zaxis = gd._fullLayout.scene.zaxis;
expect(isNaN(zaxis._length)).toBe(true);
expect(zaxis.dtick === undefined).toBe(true);
})
.catch(failTest)
.then(done);
});
});

describe('Test gl3d modebar handlers', function() {
Expand Down