Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert trace changes
  • Loading branch information
jonmmease committed Nov 28, 2020
commit 67ccac94e30ceb9063dd4db6edf469b55988c0a4
16 changes: 5 additions & 11 deletions src/traces/heatmap/xyz_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,19 @@ module.exports = function handleXYZDefaults(traceIn, traceOut, coerce, layout, x
yName = yName || 'y';
var x, y;

var shapeX = x ? (x.shape ? x.shape[0] : x.length) || 0 : 0;
var shapeY = y ? (y.shape ? y.shape[0] : y.length) || 0 : 0;
var shapeZ = z ? (z.shape ? z.shape[0] : z.length) || 0 : 0;
if(z === undefined || !z.length) return 0;

var zlen = shapeZ || (z && z.length) || 0;

if(z === undefined || !zlen) return 0;

if(Lib.isArray1D(traceIn.z) || (z && z.shape && z.shape.length === 1)) {
if(Lib.isArray1D(traceIn.z)) {
x = coerce(xName);
y = coerce(yName);

var xlen = shapeX || Lib.minRowLength(x);
var ylen = shapeY || Lib.minRowLength(y);
var xlen = Lib.minRowLength(x);
var ylen = Lib.minRowLength(y);

// column z must be accompanied by xName and yName arrays
if(xlen === 0 || ylen === 0) return 0;

traceOut._length = Math.min(xlen, ylen, zlen);
traceOut._length = Math.min(xlen, ylen, z.length);
} else {
x = coordDefaults(xName, coerce);
y = coordDefaults(yName, coerce);
Expand Down
18 changes: 6 additions & 12 deletions src/traces/isosurface/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,12 @@ function supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce) {
var z = coerce('z');
var value = coerce('value');

var len = 0;

if(x && y && z && value) {
len = Math.min(
(x.shape ? x.shape[0] : x.length) || 0,
(y.shape ? y.shape[0] : y.length) || 0,
(z.shape ? z.shape[0] : z.length) || 0,
(value.shape ? value.shape[0] : value.length) || 0
);
}

if(!len) {
if(
!x || !x.length ||
!y || !y.length ||
!z || !z.length ||
!value || !value.length
) {
traceOut.visible = false;
return;
}
Expand Down
11 changes: 4 additions & 7 deletions src/traces/scatter/xy_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) {
var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults');
handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout);

var shapeX = x && x.shape ? x.shape[0] : 0;
var shapeY = y && y.shape ? y.shape[0] : 0;

if(x) {
var xlen = shapeX || Lib.minRowLength(x);
var xlen = Lib.minRowLength(x);
if(y) {
len = shapeY || Math.min(xlen, Lib.minRowLength(y));
len = Math.min(xlen, Lib.minRowLength(y));
} else {
len = shapeX || xlen;
len = xlen;
coerce('y0');
coerce('dy');
}
} else {
if(!y) return 0;

len = shapeY || Lib.minRowLength(y);
len = Lib.minRowLength(y);
coerce('x0');
coerce('dx');
}
Expand Down
6 changes: 1 addition & 5 deletions src/traces/scatter3d/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,8 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) {
handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout);

if(x && y && z) {
var shapeX = (x.shape ? x.shape[0] : x.length) || 0;
var shapeY = (y.shape ? y.shape[0] : y.length) || 0;
var shapeZ = (z.shape ? z.shape[0] : z.length) || 0;

// TODO: what happens if one is missing?
len = Math.min(shapeX, shapeY, shapeZ);
len = Math.min(x.length, y.length, z.length);
traceOut._length = traceOut._xlength = traceOut._ylength = traceOut._zlength = len;
}

Expand Down