Skip to content

Fix to remove webgl warnings resulted from blank texts in scatter3d #3133

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

Closed
wants to merge 11 commits into from
26 changes: 20 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@
"d3-force": "^1.0.6",
"delaunay-triangulate": "^1.1.6",
"es6-promise": "^3.0.2",
"fast-isnumeric": "^1.1.1",
"fast-isnumeric": "^1.1.2",
"font-atlas-sdf": "^1.3.3",
"gl-cone3d": "^1.1.0",
"gl-contour2d": "^1.1.4",
@@ -80,7 +80,7 @@
"gl-plot2d": "^1.3.1",
"gl-plot3d": "^1.5.7",
"gl-pointcloud2d": "^1.0.1",
"gl-scatter3d": "^1.0.11",
"gl-scatter3d": "git://github.com/gl-vis/gl-scatter3d.git#8915d2ec6a89b7dc76e216487e82143dbc165c6f",
"gl-select-box": "^1.0.2",
"gl-spikes2d": "^1.0.1",
"gl-streamtube3d": "^1.0.0",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions test/image/mocks/gl3d_scatter3d-blank-text.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"data": [
{
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
"y": [0,0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],

"type": "scatter3d",
"mode":"lines+text",
"line":{ "width": 5 }
},
{
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
"y": [1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],

"text": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],

"type": "scatter3d",
"mode":"lines+text",
"line":{ "width": 5 }
},
{
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
"y": [2,2,2,2,2,2,2,2,2,2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],

"text": [0,1e-3,0.1,"A","B","C","D","E","F","G",null,"I",null,"K","L","M","N",{"text":"X", "value":10.01},"Y","Zzz"],

"type": "scatter3d",
"mode":"lines+text",
"line":{ "width": 5 }
},
{
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
"y": [3,3,3,3,3,3,3,3,3,3,3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],

"text": [0,0.0,-0,-0.0,"","0"," ","E","\n","G",null,"I",null,"K",null,null,null,"X"],

"type": "scatter3d",
"mode":"lines+text",
"line":{ "width": 5 }
}

],
"layout": {
"title":"scatter3d lines with good/bad/no input texts (including undefined, null & blank variations) should be displayed well on WEBGL",
"width": 1200,
"height": 900,
"scene":{
"camera":{
"eye":{"x":-1.25,"y":1.25,"z":1.25},
"center":{"x":0,"y":0,"z":0},
"up":{"x":0,"y":0,"z":1}
}
}
}
}
21 changes: 21 additions & 0 deletions test/jasmine/tests/gl3d_plot_interact_test.js
Original file line number Diff line number Diff line change
@@ -510,6 +510,27 @@ describe('Test gl3d plots', function() {
.then(done);
});


it('@gl should avoid passing blank texts to webgl', function(done) {
function assertIsFilled(msg) {
var fullLayout = gd._fullLayout;
expect(fullLayout.scene._scene.glplot.objects[0].glyphBuffer.length).not.toBe(0, msg);
}

Plotly.plot(gd, [{
type: 'scatter3d',
mode: 'text',
x: [1, 2, 3],
y: [2, 3, 1],
z: [3, 1, 2]
}])
.then(function() {
assertIsFilled('not to be empty text');
})
.catch(failTest)
.then(done);
});

});

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