Skip to content

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

Merged
etpinard merged 8 commits into
masterfrom
filter-enabled-false-when-empty-target-array
May 8, 2019
Merged

Set enabled:false when filter target array is empty#3766
etpinard merged 8 commits into
masterfrom
filter-enabled-false-when-empty-target-array

Conversation

@etpinard

Copy link
Copy Markdown
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
if(enabled) {
var target = coerce('target');

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

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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)
@etpinardetpinard added this to the v1.48.0 milestone Apr 26, 2019
@etpinardetpinard mentioned this pull request Apr 29, 2019
@archmoj

Copy link
Copy Markdown
Contributor

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

@etpinard

Copy link
Copy Markdown
ContributorAuthor

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

and the fix is in 84c3606

@archmoj

Copy link
Copy Markdown
Contributor

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

@etpinard

Copy link
Copy Markdown
ContributorAuthor

Should we handle [ [ ] ] case also?

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

@archmoj

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

Could you please provide a codepen example for that?

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

@archmoj

Copy link
Copy Markdown
Contributor

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

etpinard commented May 8, 2019

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

Excellent.
[ [ 💃 ] ]

@etpinard
etpinard merged commit d6da48e into masterMay 8, 2019
@etpinard
etpinard deleted the filter-enabled-false-when-empty-target-array branch May 8, 2019 20:54
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugsomething broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple issues with transforms

2 participants

@etpinard@archmoj