Skip to content

Commit

Permalink
Merge pull request #3011 from plotly/2881-scatter3d-fix-errorbars
Browse files Browse the repository at this point in the history
scatter3d display errorbars when error_z is not specified
  • Loading branch information
antoinerg authored Sep 17, 2018
2 parents ed39d82 + 7542e6f commit b6d5283
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/traces/scatter3d/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ function constructDelaunay(points, color, axis) {
function calculateErrorParams(errors) {
var capSize = [0.0, 0.0, 0.0],
color = [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
lineWidth = [0.0, 0.0, 0.0];
lineWidth = [1.0, 1.0, 1.0];

for(var i = 0; i < 3; i++) {
var e = errors[i];

if(e && e.copy_zstyle !== false) e = errors[2];
if(!e) continue;
if(e && e.copy_zstyle !== false && errors[2].visible !== false) e = errors[2];
if(!e || !e.visible) continue;

capSize[i] = e.width / 2; // ballpark rescaling
color[i] = str2RgbaArray(e.color);
lineWidth = e.thickness;
lineWidth[i] = e.thickness;

}

Expand Down
Binary file added test/image/baselines/gl3d_errorbars_xy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions test/image/mocks/gl3d_errorbars_xy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"data": [{
"type": "scatter3d",
"mode": "markers",
"x": [5, 10],
"y": [5, 10],
"z": [5, 10],
"error_x": {
"type": "sqrt",
"color": "red"
},
"error_y": {
"type": "sqrt"
}
}],
"layout": {}
}
3 changes: 2 additions & 1 deletion test/image/mocks/gl3d_errorbars_zx.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"error_x": {
"type": "constant",
"value": 0.1,
"color": "black"
"color": "black",
"thickness": 10
},
"marker": {
"symbol": "square"
Expand Down

0 comments on commit b6d5283

Please sign in to comment.