question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nestedProperty results in modal Plotly.restyle

See original GitHub issue

See: http://codepen.io/rsreusser/pen/NjKXqJ?editors=0010

It seems to me that Plotly.restyle is modal in an undesirable way. That is, the same command succeeds or fails depending on the value of current data. Right now value of the filter transform is the only property which I’m aware exhibits this since either a number or an array is valid, but there may be others.

Consider:

  1. value is a number
  2. restyle 'value[0]' ⟶ fails because you can’t set property [0] of a number
  3. restyle 'value': [0, 0] ⟶ succeeds
  4. restyle 'value[0]' ⟶ succeeds

So the same command both fails and succeeds. You’re welcome to close this, but it seems undesirable and uncommon, so I’d love to answer it definitively before it becomes a common usage that can’t be undone. (Which is to say, carpet adds another usage of this and I’m currently struggling with the fallout.)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rreussercommented, Apr 11, 2017

Agreed. My takeaways:

  1. it’s probably best for the client to resolve the intent. If you want to set two values simultaneously, then the widget should probably assign the array value as one instead of two independent inputs.
  2. small API surface area is good, but polymorphic array/scalar fields are probably best avoided when it’s not too cumbersome.
0reactions
alexcjohnsoncommented, Apr 11, 2017

My concern about this is that in general (including most arrayOk cases), 5 and [5] are not equivalent. When used for alongside a data array, 5 applies to all points whereas [5] applies to the first point and the rest receive some sort of default value. Even in this case, you wouldn’t just change from 5 to [5, 6], would you? You’d change operation as well, to [] or something, and you also can’t use 5 with [] so they necessarily need to happen together.

You could say then that we should automatically wrap or unwrap the value… but I don’t think that works either: depending on which operation you changed to, the “natural” place to put the 5 depends on which operation you’re coming from and going to… eg '<' to '[]' the 5 would naturally belong in index 1, but going to '][' it would belong in 0. And if you’re unwrapping, what would you do with the extra value? Which one is extra?

So it seems to me safer to leave it as is, that the user must provide the whole object if she wishes to change its type between bare value, array, and hash.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[WIP] Crossfilter discussion · Issue #1316 · plotly/plotly.js
Each action is mapped into a transform of a (current) state to a next state; the state object itself is modeled as a...
Read more >
Plotly.js: Why do I have to use a nested array when updating a ...
I found the solution in the doc to Plotly.restyle: In restyle, arrays are assumed to be used in conjunction with the trace indices...
Read more >
dashCoreComponents.pdf
A core set of com- ponents, written and maintained by the 'Dash' team, is available in the 'dashCoreComponents' package. The source for this ......
Read more >
Docstrings · DashCoreComponents.jl - JuliaHub
The values and labels of the checklist are specified in the options property and the checked items are specified with the value property....
Read more >
Untitled
Nz maths curriculum books, Shallwecraft, Leh ratree ep 12 eng sub, Fallout 3 fort ... Kara para ask 25 bolum 1 kisim, Auction...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found