Skip to content

Commit b643238

Browse files
committed
get filter transform to work with scattercarpet traces
1 parent afad530 commit b643238

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/plots/plots.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -2730,17 +2730,13 @@ plots.doCalcdata = function(gd, traces) {
27302730
);
27312731
}
27322732

2733-
setupAxisCategories(axList, fullData);
2734-
27352733
var hasCalcTransform = false;
27362734

2737-
// transform loop
2738-
for(i = 0; i < fullData.length; i++) {
2735+
function transformCalci(i) {
27392736
trace = fullData[i];
2737+
_module = trace._module;
27402738

27412739
if(trace.visible === true && trace.transforms) {
2742-
_module = trace._module;
2743-
27442740
// we need one round of trace module calc before
27452741
// the calc transform to 'fill in' the categories list
27462742
// used for example in the data-to-coordinate method
@@ -2767,9 +2763,6 @@ plots.doCalcdata = function(gd, traces) {
27672763
}
27682764
}
27692765

2770-
// clear stuff that should recomputed in 'regular' loop
2771-
if(hasCalcTransform) setupAxisCategories(axList, fullData);
2772-
27732766
function calci(i, isContainer) {
27742767
trace = fullData[i];
27752768
_module = trace._module;
@@ -2814,6 +2807,16 @@ plots.doCalcdata = function(gd, traces) {
28142807
calcdata[i] = cd;
28152808
}
28162809

2810+
setupAxisCategories(axList, fullData);
2811+
2812+
// 'transform' loop - must calc container traces first
2813+
// so that if their dependent traces can get transform properly
2814+
for(i = 0; i < fullData.length; i++) calci(i, true);
2815+
for(i = 0; i < fullData.length; i++) transformCalci(i);
2816+
2817+
// clear stuff that should recomputed in 'regular' loop
2818+
if(hasCalcTransform) setupAxisCategories(axList, fullData);
2819+
28172820
// 'regular' loop - make sure container traces (eg carpet) calc before
28182821
// contained traces (eg contourcarpet)
28192822
for(i = 0; i < fullData.length; i++) calci(i, true);

test/jasmine/tests/transform_filter_test.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1349,8 +1349,7 @@ describe('filter resulting in empty coordinate arrays', function() {
13491349
var mockList = require('../assets/mock_lists').svg;
13501350

13511351
mockList.forEach(function(d) {
1352-
if(d[0] === 'scattercarpet' || d[0] === 'world-cals') {
1353-
// scattercarpet don't work with transforms
1352+
if(d[0] === 'world-cals') {
13541353
// world-cals mock complains during a Lib.cleanDate()
13551354
return;
13561355
}

0 commit comments

Comments
 (0)