Skip to content

Commit 1dddc6e

Browse files
authored
Merge pull request #1730 from plotly/gl3d-set-ranges
Fix scene-bounds logic for non-linear axis set ranges
2 parents b0892ce + 0a2a4a5 commit 1dddc6e

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

src/plots/gl3d/scene.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,9 @@ proto.plot = function(sceneData, fullLayout, layout) {
472472
sceneBounds[1][i] += d / 32.0;
473473
}
474474
} else {
475-
var range = fullSceneLayout[axisProperties[i]].range;
476-
sceneBounds[0][i] = range[0];
477-
sceneBounds[1][i] = range[1];
475+
var range = axis.range;
476+
sceneBounds[0][i] = axis.r2l(range[0]);
477+
sceneBounds[1][i] = axis.r2l(range[1]);
478478
}
479479
if(sceneBounds[0][i] === sceneBounds[1][i]) {
480480
sceneBounds[0][i] -= 1;
19.7 KB
Loading

test/image/mocks/gl3d_set-ranges.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"data": [{
3+
"type": "scatter3d",
4+
"x": ["2017-01-01", "2017-02-10", "2017-03-20"],
5+
"y": ["A", "B", "C"],
6+
"z": [1, 1e3, 1e5]
7+
}],
8+
"layout": {
9+
"scene": {
10+
"camera": {
11+
"eye": {"x": 2.1, "y": 0.1, "z": 0.9}
12+
},
13+
"xaxis": {
14+
"title": "",
15+
"range": ["2016-01-01", "2017-06-01"],
16+
"dtick": "M4"
17+
},
18+
"yaxis": {
19+
"title": "",
20+
"range": [-1, 3]
21+
},
22+
"zaxis": {
23+
"type": "log",
24+
"title": "",
25+
"range": [0, 4]
26+
}
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)