Skip to content

Filter transform doesn't restore data text #1666

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

Closed
n-riesco opened this issue May 10, 2017 · 3 comments · Fixed by #1672
Closed

Filter transform doesn't restore data text #1666

n-riesco opened this issue May 10, 2017 · 3 comments · Fixed by #1672
Assignees
Labels
bug something broken

Comments

@n-riesco
Copy link
Contributor

I'm using filter transforms to hide and show points in a trace. These points have a text and I've noticed that in some cases when I unhide a point, its text isn't displayed.

Here's a codepen reproducing the issue.

peek 2017-05-10 18-58

@etpinard
Copy link
Contributor

Interesting. Thanks for the report @n-riesco !

I can replicate the problem on master. By inspecting fullData and calcdata, the filter transform appear to do the right thing. Something must be up in the plot routine.

@etpinard etpinard added the bug something broken label May 10, 2017
@etpinard etpinard self-assigned this May 10, 2017
@etpinard
Copy link
Contributor

etpinard commented May 10, 2017

OK. I found the problem. When a filter transform filters out all items in data arrays the resulting fullData items is inconsistent with what the plot step expects. More precisely, filter transforms allows for fullData items containing:

x: [],
y: [],
visible: true

whereas (all?) other plotly code paths force visible: false whenever blank coordinates are found.

In details, logging x, y and visible in fullData after restyle(gd, 'transforms', /* */)` call gives:

peek 2017-05-10 17-50

Luckily the marker points appear to update correctly when x and y are blank. No luck for the text point nodes though. But, we should not rely on the plot step knowing what to do with blank x / y arrays. Instead we should make sure the filter transform forces in visible: false. Perhaps we should call Plots.supplyDefaults after the calc transform is applied (probably an overkill)?


In brief @n-riesco , one workaround would have your toggle buttons never reach that transform.target = [0, 0, 0] state. In the case, the restyle command should be restyle(gd, 'visible', false). I hope this helps.

@n-riesco
Copy link
Contributor Author

@etpinard How about filter transforms setting visible to false whenever they result in an empty trace? Would that fix the issue?

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 a pull request may close this issue.

2 participants