Skip to content

Commit 3c693a0

Browse files
committed
make findArrayAttributes track arrayOk attrs in base trace attrs
- e.g. hoverinfo, hoverlabel.bgcolor etc ...
1 parent e8a9ddd commit 3c693a0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/plot_api/plot_schema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ exports.findArrayAttributes = function(trace) {
156156
return stack.join('.');
157157
}
158158

159+
exports.crawl(baseAttributes, callback);
159160
exports.crawl(trace._module.attributes, callback);
160161

161162
if(trace.transforms) {

test/jasmine/tests/transform_filter_test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,25 @@ describe('filter transforms calc:', function() {
262262
expect(out[0].marker.color).toEqual([0.3, 0.3, 0.4]);
263263
});
264264

265+
it('filters should handle array on base trace attributes', function() {
266+
var out = _transform([Lib.extendDeep({}, base, {
267+
hoverinfo: ['x', 'y', 'text', 'name', 'none', 'skip', 'all'],
268+
hoverlabel: {
269+
bgcolor: ['red', 'green', 'blue', 'black', 'yellow', 'cyan', 'pink'],
270+
},
271+
transforms: [{
272+
type: 'filter',
273+
operation: '>',
274+
value: 0
275+
}]
276+
})]);
277+
278+
expect(out[0].x).toEqual([1, 2, 3]);
279+
expect(out[0].y).toEqual([2, 3, 1]);
280+
expect(out[0].hoverinfo).toEqual(['none', 'skip', 'all']);
281+
expect(out[0].hoverlabel.bgcolor).toEqual(['yellow', 'cyan', 'pink']);
282+
});
283+
265284
it('filters should skip if *enabled* is false', function() {
266285
var out = _transform([Lib.extendDeep({}, base, {
267286
transforms: [{

0 commit comments

Comments
 (0)