Skip to content

Commit 5d6a4a0

Browse files
committed
get the right _xlength for surface if x is 2D
There are a bunch of extra edge cases here if the x/y/z arrays don't have one of the expected sizes/dimensionalities... but this covers more than it used to anyhow, and gets the ribbons mock right.
1 parent 2a7d640 commit 5d6a4a0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/traces/surface/convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ proto.update = function(data) {
200200
yaxis = sceneLayout.yaxis,
201201
zaxis = sceneLayout.zaxis,
202202
scaleFactor = scene.dataScale,
203-
xlen = data._xlength,
203+
xlen = z[0].length,
204204
ylen = data._ylength,
205205
coords = [
206206
ndarray(new Float32Array(xlen * ylen), [xlen, ylen]),

src/traces/surface/defaults.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2929
return;
3030
}
3131

32-
traceOut._xlength = z[0].length;
33-
traceOut._ylength = z.length;
34-
35-
coerce('x');
32+
var x = coerce('x');
3633
coerce('y');
3734

35+
traceOut._xlength = (Array.isArray(x) && Array.isArray(x[0])) ? z.length : z[0].length;
36+
traceOut._ylength = z.length;
37+
3838
var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults');
3939
handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout);
4040

test/image/baselines/gl3d_ribbons.png

4.14 KB
Loading

0 commit comments

Comments
 (0)