Skip to content

Commit 4d5b382

Browse files
committed
Back to decoding in coerce
1 parent 712a124 commit 4d5b382

File tree

4 files changed

+4
-38
lines changed

4 files changed

+4
-38
lines changed

src/lib/array.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ exports.isArrayOrTypedArray = isArrayOrTypedArray;
4141
* not consistent we won't figure that out here.
4242
*/
4343
function isArray1D(a) {
44-
return !(isArrayOrTypedArray(a[0]) || (isTypedArraySpec(a) && a.ndims === 1));
44+
return !isArrayOrTypedArray(a[0]);
4545
}
4646
exports.isArray1D = isArray1D;
4747

@@ -83,6 +83,7 @@ exports.typedArrays = typedArrays;
8383

8484
exports.decodeTypedArraySpec = function(v) {
8585
// Assume processed by coerceTypedArraySpec
86+
v = coerceTypedArraySpec(v)
8687
var T = typedArrays[v.dtype];
8788
var buffer;
8889
if(v.bvals.constructor === ArrayBuffer) {
@@ -259,8 +260,6 @@ function _rowLength(z, fn, len0) {
259260
} else {
260261
return z.length;
261262
}
262-
} else if(isTypedArraySpec(z)) {
263-
return z.shape[z.shape.length - 1];
264263
}
265264
return 0;
266265
}

src/lib/coerce.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var counterRegex = require('./regex').counter;
2020
var modHalf = require('./mod').modHalf;
2121
var isArrayOrTypedArray = require('./array').isArrayOrTypedArray;
2222
var isTypedArraySpec = require('./array').isTypedArraySpec;
23-
var coerceTypedArraySpec = require('./array').coerceTypedArraySpec;
23+
var decodeTypedArraySpec = require('./array').decodeTypedArraySpec;
2424

2525

2626
exports.valObjectMeta = {
@@ -42,7 +42,7 @@ exports.valObjectMeta = {
4242
propOut.set(v);
4343
wasSet = true;
4444
} else if(isTypedArraySpec(v)) {
45-
propOut.set(coerceTypedArraySpec(v));
45+
propOut.set(decodeTypedArraySpec(v));
4646
wasSet = true;
4747
}
4848
if(!wasSet && dflt !== undefined) propOut.set(dflt);

src/plots/plots.js

-31
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
var d3 = require('d3');
1212
var timeFormatLocale = require('d3-time-format').timeFormatLocale;
1313
var isNumeric = require('fast-isnumeric');
14-
var decodeTypedArraySpec = require('../lib/array').decodeTypedArraySpec;
15-
var isTypedArraySpec = require('../lib/array').isTypedArraySpec;
1614

1715
var Registry = require('../registry');
1816
var PlotSchema = require('../plot_api/plot_schema');
@@ -2850,36 +2848,7 @@ function _transition(gd, transitionOpts, opts) {
28502848
return transitionStarting.then(function() { return gd; });
28512849
}
28522850

2853-
function _decode(cont) {
2854-
if(isTypedArraySpec(cont)) {
2855-
return decodeTypedArraySpec(cont);
2856-
}
2857-
for(var prop in cont) {
2858-
if(prop[0] !== '_' && cont.hasOwnProperty(prop)) {
2859-
var item = cont[prop];
2860-
if(Lib.isPlainObject(item)) {
2861-
var r = _decode(item);
2862-
if(r !== undefined) cont[prop] = r;
2863-
} else if(Array.isArray(cont) && cont.length > 0 && Lib.isPlainObject(cont[0])) {
2864-
for(var i = 0; i < cont.length; i++) {
2865-
_decode(cont[i]);
2866-
}
2867-
}
2868-
}
2869-
}
2870-
}
2871-
2872-
function decodeTypedArrays(gd) {
2873-
for(var i = 0; i < gd._fullData.length; i++) {
2874-
_decode(gd._fullData[i]);
2875-
}
2876-
2877-
_decode(gd._fullLayout);
2878-
}
2879-
28802851
plots.doCalcdata = function(gd, traces) {
2881-
decodeTypedArrays(gd);
2882-
28832852
var axList = axisIDs.list(gd);
28842853
var fullData = gd._fullData;
28852854
var fullLayout = gd._fullLayout;

src/traces/isosurface/defaults.js

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ function supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce) {
3838
var z = coerce('z');
3939
var value = coerce('value');
4040

41-
console.log(["x", x]);
42-
4341
if(
4442
!x || !x.length ||
4543
!y || !y.length ||

0 commit comments

Comments
 (0)