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

Conversation

etpinard
Copy link
Contributor

closes #2908 - by implementing #2908 (comment)

cc @plotly/plotly_js

before/after example: https://codepen.io/etpinard/pen/wYdppB / https://codepen.io/etpinard/pen/WWOVBV

- see #2908 for more info,
- this fixes many potential problems downstream
@etpinard etpinard added bug something broken status: reviewable labels Apr 12, 2019
@@ -138,10 +138,16 @@ exports.supplyDefaults = function(transformIn) {
var enabled = coerce('enabled');

if(enabled) {
var target = coerce('target');

if(Lib.isArrayOrTypedArray(target) && target.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard Thanks for the PR.
Cool!
What about handling a case like this: [ [ ] ]?
See codepen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Thanks for the review!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@archmoj this turned out to be a bit more of a project than anticipated.

See 3a5a4c2 - which makes things work for all trace types except scattercarpet and in some world-calendar scenario. I'll try to get those two cases fixed before 1.48.0, but in the meantime here's "a good chuck" of the solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which makes things work for all trace types except scattercarpet and in some world-calendar scenario.

Now fixed by b643238 and 40c8abc

Making this PR ready for a second 👁️

... after transform _module.calc loop

- that way filter transforms that remove all data coordinates
  don't result in errors
- of all the mocks listed in mock_lists.js, only 'scattercarpet' and
  'world-cals' still error out (wip)
@etpinard etpinard added this to the v1.48.0 milestone Apr 26, 2019
@etpinard etpinard mentioned this pull request Apr 29, 2019
@archmoj
Copy link
Contributor

archmoj commented May 8, 2019

@etpinard you mentioned a possible conflict on funnel PR here:
#3817 (comment)

@etpinard
Copy link
Contributor Author

etpinard commented May 8, 2019

@etpinard you mentioned a possible conflict on funnel PR here:
#3817 (comment)

and the fix is in 84c3606

@archmoj
Copy link
Contributor

archmoj commented May 8, 2019

Looks very good.
Should we handle [ [ ] ] case also?

@etpinard
Copy link
Contributor Author

etpinard commented May 8, 2019

Should we handle [ [ ] ] case also?

It is handled as it results in trace._length=0

@archmoj
Copy link
Contributor

archmoj commented May 8, 2019

Should we handle [ [ ] ] case also?

It is handled as it results in trace._length=0

Could you please provide a codepen example for that?
Thanks.

@etpinard
Copy link
Contributor Author

etpinard commented May 8, 2019

Could you please provide a codepen example for that?

https://codepen.io/etpinard/pen/dEYQXW

@archmoj
Copy link
Contributor

archmoj commented May 8, 2019

Could you please provide a codepen example for that?

https://codepen.io/etpinard/pen/dEYQXW

Thanks. Now could you please check this one.
Is that the expected behaviour?

@etpinard
Copy link
Contributor Author

etpinard commented May 8, 2019

Is that the expected behaviour?

I think so. It's not great, but I think traces with _length===0 should still get a legend item as mentioned in #2908 (comment)

@archmoj
Copy link
Contributor

archmoj commented May 8, 2019

Excellent.
[ [ 💃 ] ]

@etpinard etpinard merged commit d6da48e into master May 8, 2019
@etpinard etpinard deleted the filter-enabled-false-when-empty-target-array branch May 8, 2019 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple issues with transforms
2 participants