Skip to content

API for deleting transforms and other new Plotly.js components #1069

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
bpostlethwaite opened this issue Oct 24, 2016 · 7 comments · Fixed by #1086
Closed

API for deleting transforms and other new Plotly.js components #1069

bpostlethwaite opened this issue Oct 24, 2016 · 7 comments · Fixed by #1086
Labels
bug something broken feature something new
Milestone

Comments

@bpostlethwaite
Copy link
Member

We have an API for adding these things but there is no way to remove them yet.

cc @etpinard

@bpostlethwaite bpostlethwaite added bug something broken feature something new labels Oct 24, 2016
@rreusser
Copy link
Contributor

rreusser commented Oct 24, 2016

Yes, this is a downside of the container array format. One small caveat here is what happens if something references, for example, transform[3].values and you delete transform #2. I think it's possible to overwrite 'transform[2]': {} so that it becomes a no-op, but that's not quite ideal.

@bpostlethwaite
Copy link
Member Author

bpostlethwaite commented Oct 24, 2016

As far as writing referencing code I don't see transforms any differently from traces or annotations. Plotlyjs supports deletion in both cases.

We use UIDs in Plotly application code for exactly this reason. I imagine other application writers are accustomed to doing the same. It adds a layer of indirection (find the index that has a matching UID before making a Plotlyjs call) but it is expected when writing non-trivial applications.

@bpostlethwaite
Copy link
Member Author

And for trivial cases like single run scripts I doubt deletion is used frequently.

@rreusser
Copy link
Contributor

rreusser commented Oct 24, 2016

One possible approach: change nestedProperty array lookup code so that if the array index is not an integer (e.g. transforms[stringId]) then it will look though the array for the object with uid: 'stringId' instead. Ideally that would not affect any existing code, but it's just a little weird. (though are uids just string integers by default?)

@rreusser
Copy link
Contributor

As far as writing referencing code I don't see transforms any differently from traces or annotations. Plotlyjs supports deletion in both cases.

Oh, wait. I'm confused then. Isn't the API the same for modifying annotations and transforms? Does relayout succeed in deleting them where restyle fails?

@bpostlethwaite
Copy link
Member Author

There are specific lines of code for dealing with annotations that have not been replicated for transforms. There isn't a general array mutation pathway in relayout or restyle.

@rreusser
Copy link
Contributor

Got it. I understand now. Thanks for clarifying. Those should be replicated; I'll just reiterate quickly my concern about having built a system that may actually include references to the array indices in other potentially-arbitrary places. (like an animation modifying transforms[0].value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken feature something new
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants