Skip to content

Commit 94fb8a4

Browse files
committed
Merge branch 'master' into issue-1976
2 parents 2f7d8fe + 0d0f303 commit 94fb8a4

File tree

10 files changed

+254
-32
lines changed

10 files changed

+254
-32
lines changed

package-lock.json

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"d3-force": "^1.0.6",
6969
"delaunay-triangulate": "^1.1.6",
7070
"es6-promise": "^3.0.2",
71-
"fast-isnumeric": "^1.1.1",
71+
"fast-isnumeric": "^1.1.2",
7272
"font-atlas-sdf": "^1.3.3",
7373
"gl-cone3d": "^1.2.0",
7474
"gl-contour2d": "^1.1.4",
@@ -80,7 +80,7 @@
8080
"gl-plot2d": "^1.3.1",
8181
"gl-plot3d": "^1.5.10",
8282
"gl-pointcloud2d": "^1.0.1",
83-
"gl-scatter3d": "^1.0.12",
83+
"gl-scatter3d": "^1.0.13",
8484
"gl-select-box": "^1.0.2",
8585
"gl-spikes2d": "^1.0.1",
8686
"gl-streamtube3d": "^1.1.0",

src/traces/bar/cross_trace_calc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ function applyAttributes(sieve) {
356356

357357
if(isArrayOrTypedArray(offset)) {
358358
// if offset is an array, then clone it into t.poffset.
359-
newPoffset = offset.slice(0, calcTrace.length);
359+
newPoffset = Array.prototype.slice.call(offset, 0, calcTrace.length);
360360

361361
// guard against non-numeric items
362362
for(j = 0; j < newPoffset.length; j++) {
@@ -377,12 +377,12 @@ function applyAttributes(sieve) {
377377
t.poffset = offset;
378378
}
379379

380-
var width = fullTrace._width || fullTrace.width,
381-
initialBarwidth = t.barwidth;
380+
var width = fullTrace._width || fullTrace.width;
381+
var initialBarwidth = t.barwidth;
382382

383383
if(isArrayOrTypedArray(width)) {
384384
// if width is an array, then clone it into t.barwidth.
385-
var newBarwidth = width.slice(0, calcTrace.length);
385+
var newBarwidth = Array.prototype.slice.call(width, 0, calcTrace.length);
386386

387387
// guard against non-numeric items
388388
for(j = 0; j < newBarwidth.length; j++) {

src/traces/splom/attributes.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@ var extendFlat = require('../../lib/extend').extendFlat;
1818
var scatterMarkerAttrs = scatterAttrs.marker;
1919
var scatterMarkerLineAttrs = scatterMarkerAttrs.line;
2020

21+
var markerLineAttrs = extendFlat(colorAttrs('marker.line', {editTypeOverride: 'calc'}), {
22+
width: extendFlat({}, scatterMarkerLineAttrs.width, {editType: 'calc'}),
23+
editType: 'calc'
24+
});
25+
26+
var markerAttrs = extendFlat(colorAttrs('marker'), {
27+
symbol: scatterMarkerAttrs.symbol,
28+
size: extendFlat({}, scatterMarkerAttrs.size, {editType: 'markerSize'}),
29+
sizeref: scatterMarkerAttrs.sizeref,
30+
sizemin: scatterMarkerAttrs.sizemin,
31+
sizemode: scatterMarkerAttrs.sizemode,
32+
opacity: scatterMarkerAttrs.opacity,
33+
colorbar: scatterMarkerAttrs.colorbar,
34+
line: markerLineAttrs,
35+
editType: 'calc'
36+
});
37+
38+
markerAttrs.color.editType = markerAttrs.cmin.editType = markerAttrs.cmax.editType = 'style';
39+
2140
function makeAxesValObject(axLetter) {
2241
return {
2342
valType: 'info_array',
@@ -105,20 +124,7 @@ module.exports = {
105124
].join(' ')
106125
}),
107126

108-
marker: extendFlat({}, colorAttrs('marker'), {
109-
symbol: scatterMarkerAttrs.symbol,
110-
size: extendFlat({}, scatterMarkerAttrs.size, {editType: 'markerSize'}),
111-
sizeref: scatterMarkerAttrs.sizeref,
112-
sizemin: scatterMarkerAttrs.sizemin,
113-
sizemode: scatterMarkerAttrs.sizemode,
114-
opacity: scatterMarkerAttrs.opacity,
115-
colorbar: scatterMarkerAttrs.colorbar,
116-
line: extendFlat({}, colorAttrs('marker.line'), {
117-
width: scatterMarkerLineAttrs.width,
118-
editType: 'calc'
119-
}),
120-
editType: 'calc'
121-
}),
127+
marker: markerAttrs,
122128

123129
xaxes: makeAxesValObject('x'),
124130
yaxes: makeAxesValObject('y'),

src/traces/splom/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,17 @@ function editStyle(gd, cd0) {
309309
var trace = cd0.trace;
310310
var scene = gd._fullLayout._splomScenes[trace.uid];
311311

312-
calcColorscales(trace);
312+
if(scene) {
313+
calcColorscales(trace);
313314

314-
Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(trace));
315-
// TODO [un]selected styles?
315+
Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(trace));
316+
// TODO [un]selected styles?
316317

317-
var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts);
318+
var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts);
318319

319-
// TODO this is too long for arrayOk attributes!
320-
scene.matrix.update(opts, null);
320+
// TODO this is too long for arrayOk attributes!
321+
scene.matrix.update(opts, null);
322+
}
321323
}
322324

323325
function hoverPoints(pointData, xval, yval) {
Loading
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"data": [
3+
{
4+
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
5+
"y": [0,0,0,0,0,0,0,0,0,0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
6+
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],
7+
8+
"type": "scatter3d",
9+
"mode":"lines+text",
10+
"line":{ "width": 5 }
11+
},
12+
{
13+
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
14+
"y": [1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
15+
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],
16+
17+
"text": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
18+
19+
"type": "scatter3d",
20+
"mode":"lines+text",
21+
"line":{ "width": 5 }
22+
},
23+
{
24+
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
25+
"y": [2,2,2,2,2,2,2,2,2,2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
26+
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],
27+
28+
"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"],
29+
30+
"type": "scatter3d",
31+
"mode":"lines+text",
32+
"line":{ "width": 5 }
33+
},
34+
{
35+
"x": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
36+
"y": [3,3,3,3,3,3,3,3,3,3,3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
37+
"z": [0,1,0,2,0,3,0,4,0,5,0, 6, 0, 7, 0, 8, 0, 9, 0, 10],
38+
39+
"text": [0,0.0,-0,-0.0,"","0"," ","E","\n","G",null,"I",null,"K",null,null,null,"X"],
40+
41+
"type": "scatter3d",
42+
"mode":"lines+text",
43+
"line":{ "width": 5 }
44+
}
45+
46+
],
47+
"layout": {
48+
"title":"scatter3d lines with good/bad/no input texts (including undefined, null & blank variations) should be displayed well on WEBGL",
49+
"width": 1200,
50+
"height": 900,
51+
"scene":{
52+
"camera":{
53+
"eye":{"x":-1.25,"y":1.25,"z":1.25},
54+
"center":{"x":0,"y":0,"z":0},
55+
"up":{"x":0,"y":0,"z":1}
56+
}
57+
}
58+
}
59+
}

test/jasmine/tests/bar_test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,46 @@ describe('Bar.crossTraceCalc (formerly known as setPositions)', function() {
397397
assertArrayField(cd[2][0], 't.poffset', [-0.4]);
398398
});
399399

400+
it('should work with *width* typed arrays', function() {
401+
var w = [0.1, 0.4, 0.7];
402+
403+
var gd = mockBarPlot([{
404+
width: w,
405+
y: [1, 2, 3]
406+
}, {
407+
width: new Float32Array(w),
408+
y: [1, 2, 3]
409+
}]);
410+
411+
var cd = gd.calcdata;
412+
assertArrayField(cd[0][0], 't.barwidth', w);
413+
assertArrayField(cd[1][0], 't.barwidth', w);
414+
assertPointField(cd, 'x', [
415+
[-0.2, 0.8, 1.8],
416+
[0.2, 1.2, 2.2]
417+
]);
418+
});
419+
420+
it('should work with *offset* typed arrays', function() {
421+
var o = [0.1, 0.4, 0.7];
422+
423+
var gd = mockBarPlot([{
424+
offset: o,
425+
y: [1, 2, 3]
426+
}, {
427+
offset: new Float32Array(o),
428+
y: [1, 2, 3]
429+
}]);
430+
431+
var cd = gd.calcdata;
432+
assertArrayField(cd[0][0], 't.poffset', o);
433+
assertArrayField(cd[1][0], 't.poffset', o);
434+
assertPointField(cd, 'x', [
435+
[0.5, 1.8, 3.1],
436+
[0.5, 1.8, 3.099]
437+
]);
438+
});
439+
400440
it('should guard against invalid width items', function() {
401441
var gd = mockBarPlot([{
402442
width: [null, 1, 0.8],

test/jasmine/tests/gl3d_plot_interact_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,27 @@ describe('Test gl3d plots', function() {
510510
.then(done);
511511
});
512512

513+
514+
it('@gl should avoid passing blank texts to webgl', function(done) {
515+
function assertIsFilled(msg) {
516+
var fullLayout = gd._fullLayout;
517+
expect(fullLayout.scene._scene.glplot.objects[0].glyphBuffer.length).not.toBe(0, msg);
518+
}
519+
520+
Plotly.plot(gd, [{
521+
type: 'scatter3d',
522+
mode: 'text',
523+
x: [1, 2, 3],
524+
y: [2, 3, 1],
525+
z: [3, 1, 2]
526+
}])
527+
.then(function() {
528+
assertIsFilled('not to be empty text');
529+
})
530+
.catch(failTest)
531+
.then(done);
532+
});
533+
513534
});
514535

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

0 commit comments

Comments
 (0)