Skip to content

Commit c80f144

Browse files
committed
transforms: link up tranform module to fullData transform container
- so that findArrayAttributes can track arrayOk attribute within transforms containers.
1 parent 046dd32 commit c80f144

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

src/lib/coerce.js

+11
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,17 @@ exports.findArrayAttributes = function(trace) {
458458

459459
exports.crawl(trace._module.attributes, callback);
460460

461+
if(trace.transforms) {
462+
var transforms = trace.transforms;
463+
464+
for(var i = 0; i < transforms.length; i++) {
465+
var transform = transforms[i];
466+
467+
stack = ['transforms[' + i + ']'];
468+
exports.crawl(transform._module.attributes, callback, 1);
469+
}
470+
}
471+
461472
// Look into the fullInput module attributes for array attributes
462473
// to make sure that 'custom' array attributes are detected.
463474
//

src/plots/plots.js

+1
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ function supplyTransformDefaults(traceIn, traceOut, layout) {
807807
if(_module && _module.supplyDefaults) {
808808
transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn);
809809
transformOut.type = type;
810+
transformOut._module = _module;
810811
}
811812
else {
812813
transformOut = Lib.extendFlat({}, transformIn);

test/jasmine/tests/transform_filter_test.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var Plotly = require('@lib/index');
2+
var Filter = require('@lib/filter');
3+
24
var Plots = require('@src/plots/plots');
35
var Lib = require('@src/lib');
46

@@ -27,7 +29,8 @@ describe('filter transforms defaults:', function() {
2729
enabled: true,
2830
operation: '=',
2931
value: 0,
30-
target: 'x'
32+
target: 'x',
33+
_module: Filter
3134
}]);
3235
});
3336

@@ -46,6 +49,7 @@ describe('filter transforms defaults:', function() {
4649
expect(traceOut.transforms).toEqual([{
4750
type: 'filter',
4851
enabled: false,
52+
_module: Filter
4953
}]);
5054
});
5155

test/jasmine/tests/transform_multi_test.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var Plotly = require('@lib/index');
2+
var Filter = require('@lib/filter');
3+
24
var Plots = require('@src/plots/plots');
35
var Lib = require('@src/lib');
46

@@ -26,7 +28,8 @@ describe('general transforms:', function() {
2628
enabled: true,
2729
operation: '=',
2830
value: 0,
29-
target: 'x'
31+
target: 'x',
32+
_module: Filter
3033
}]);
3134
});
3235

@@ -65,15 +68,17 @@ describe('general transforms:', function() {
6568
enabled: true,
6669
operation: '=',
6770
value: 0,
68-
target: 'x'
71+
target: 'x',
72+
_module: Filter
6973
}, '- global first');
7074

7175
expect(traceOut.transforms[1]).toEqual({
7276
type: 'filter',
7377
enabled: true,
7478
operation: '>',
7579
value: 0,
76-
target: 'x'
80+
target: 'x',
81+
_module: Filter
7782
}, '- trace second');
7883
});
7984

@@ -113,7 +118,8 @@ describe('general transforms:', function() {
113118
enabled: true,
114119
operation: '>',
115120
value: 0,
116-
target: 'x'
121+
target: 'x',
122+
_module: Filter
117123
}, msg);
118124

119125
msg = 'keeping refs to user data';
@@ -123,7 +129,7 @@ describe('general transforms:', function() {
123129
type: 'filter',
124130
operation: '>',
125131
value: 0,
126-
target: 'x'
132+
target: 'x',
127133
}], msg);
128134

129135
msg = 'keeping refs to full transforms array';
@@ -132,7 +138,8 @@ describe('general transforms:', function() {
132138
enabled: true,
133139
operation: '>',
134140
value: 0,
135-
target: 'x'
141+
target: 'x',
142+
_module: Filter
136143
}], msg);
137144

138145
msg = 'setting index w.r.t user data';

0 commit comments

Comments
 (0)