8000 Set enabled:false when filter target array is empty by etpinard · Pull Request #3766 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Set enabled:false when filter target array is empty #3766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 8, 2019
Prev Previous commit
Next Next commit
get filter transform to work with scattercarpet traces
8000
  • Loading branch information
etpinard committed Apr 29, 2019
commit b6432380de4b3474b0bec9b2f02d2bd49e416f15
21 changes: 12 additions & 9 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2730,17 +2730,13 @@ plots.doCalcdata = function(gd, traces) {
);
}

setupAxisCategories(axList, fullData);

var hasCalcTransform = false;

// transform loop
for(i = 0; i < fullData.length; i++) {
function transformCalci(i) {
trace = fullData[i];
_module = trace._module;

if(trace.visible === true && trace.transforms) {
_module = trace._module;

// we need one round of trace module calc before
// the calc transform to 'fill in' the categories list
// used for example in the data-to-coordinate method
Expand All @@ -2767,9 +2763,6 @@ plots.doCalcdata = function(gd, traces) {
}
}

// clear stuff that should recomputed in 'regular' loop
if(hasCalcTransform) setupAxisCategories(axList, fullData);

function calci(i, isContainer) {
trace = fullData[i];
_module = trace._module;
Expand Down Expand Up @@ -2814,6 +2807,16 @@ plots.doCalcdata = function(gd, traces) {
calcdata[i] = cd;
}

setupAxisCategories(axList, fullData);

// 'transform' loop - must calc container traces first
// so that if their dependent traces can get transform properly
for(i = 0; i < fullData.length; i++) calci(i, true);
for(i = 0; i < fullData.length; i++) transformCalci(i);

// clear stuff that should recomputed in 'regular' loop
if(hasCalcTransform) setupAxisCategories(axList, fullData);

// 'regular' loop - make sure container traces (eg carpet) calc before
// contained traces (eg contourcarpet)
for(i = 0; i < fullData.length; i++) calci(i, true);
Expand Down
3 changes: 1 addition & 2 deletions test/jasmine/tests/transform_filter_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1349,8 +1349,7 @@ describe('filter resulting in empty coordinate arrays', function() {
var mockList = require('../assets/mock_lists').svg;

mockList.forEach(function(d) {
if(d[0] === 'scattercarpet' || d[0] === 'world-cals') {
// scattercarpet don't work with transforms
if(d[0] === 'world-cals') {
// world-cals mock complains during a Lib.cleanDate()
return;
}
Expand Down
0