Skip to content
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

newPlot does not clear histogram axis type!!! #1231

Closed
andrewkfiedler opened this issue Dec 6, 2016 · 9 comments
Closed

newPlot does not clear histogram axis type!!! #1231

andrewkfiedler opened this issue Dec 6, 2016 · 9 comments
Labels
bug something broken
Milestone

Comments

@andrewkfiedler
Copy link

andrewkfiedler commented Dec 6, 2016

Here are the relevant codepens to reproduce:
http://codepen.io/andrewkfiedler/pen/XNqMeW?editors=0010
http://codepen.io/andrewkfiedler/pen/ObZpzv?editors=0010

In the first codepen, you can see that plotting a histogram of type 'Number' causes future histograms to be assumed to be of type 'Number' as well. As such it throws an error (the second plot is attempted 5 seconds after the first, so wait 5 seconds).

In the second codepen, you can see that plotting a histogram of type 'String' causes future histograms to be assumed to be of type 'String' as well. As such, the numbers are binned as though they are strings.

Both are examples are using Plotly.newPlot.

@etpinard
Copy link
Contributor

etpinard commented Dec 7, 2016

What is the desired behavior here in your mind?

@etpinard etpinard closed this as completed Dec 7, 2016
@etpinard etpinard reopened this Dec 7, 2016
@andrewkfiedler
Copy link
Author

In my mind, Plotly should not crash when switching the type of data used in a histogram. 'Strings' are useful in histograms to bin things into categories, while 'Numbers' are useful to group things into ranges.

Using one type should not cause Plotly to assume that's the type for all future histograms.

I'd actually prefer being allowed to specify the type instead of allowing Plotly to make the decision for me, as right now I have to append a https://en.wikipedia.org/wiki/Zero-width_space in order to force String types that sometimes involve Numbers to be seen as such.

@andrewkfiedler
Copy link
Author

Anything else I can provide to help out on this?

@etpinard
Copy link
Contributor

Oh. You're using newPlot. Ok that's bad. Sorry I thought you were complaining about multi-trace graphs being cast to the same axis type. newPlot (as the name suggests) should clean up everything about the previous graphs.

Thanks for the report.

@etpinard etpinard added the bug something broken label Dec 14, 2016
@etpinard
Copy link
Contributor

Changing the issue title to attract more attention.

@etpinard etpinard changed the title Previous histograms affect future histograms newPlot does not clear histogram axis type!!! Dec 15, 2016
@etpinard
Copy link
Contributor

The issue can be replicated all the back be to v1.0.0: not a regression.

@etpinard etpinard self-assigned this Dec 15, 2016
@etpinard
Copy link
Contributor

etpinard commented Dec 16, 2016

We haven't fixed the bug yet, but here's a workaround: http://codepen.io/etpinard/pen/dOwJoZ

Our poor user input object management is responsible for this bug.

andrewkfiedler added a commit to codice/ddf-ui that referenced this issue Dec 22, 2016
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
andrewkfiedler added a commit to codice/ddf-ui that referenced this issue Dec 22, 2016
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
pklinef pushed a commit to codice/ddf-ui that referenced this issue Dec 23, 2016
DDF-2644 
DDF-2644  - plotly/plotly.js#1229
DDF-2644  - plotly/plotly.js#1231
DDF-2644  - Also ensures that strings are treated as strings (by adding a zero width space).
pklinef pushed a commit to codice/ddf-ui that referenced this issue Dec 23, 2016
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
pklinef pushed a commit to codice/ddf-ui that referenced this issue Dec 23, 2016
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
rzwiefel pushed a commit to codice/ddf-ui that referenced this issue Dec 28, 2016
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
rzwiefel pushed a commit to rzwiefel/ddf that referenced this issue Jan 5, 2017
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
shaundmorris pushed a commit to shaundmorris/ddf that referenced this issue Mar 29, 2017
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
@alexcjohnson
Copy link
Collaborator

Just to be clear what @etpinard means by "poor user input object management" - the issue is that we mutate the layout object you pass in, so the workaround is to create a new layout object for each newPlot call.

We can only fix this in v2, at which point we can clone data and layout and mutate those rather than the ones you pass in.

@etpinard
Copy link
Contributor

Merging into #2234

rzwiefel pushed a commit to codice/ddf-ui that referenced this issue Nov 8, 2019
 - plotly/plotly.js#1229
 - plotly/plotly.js#1231
 - Also ensures that strings are treated as strings (by adding a zero width space).
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.

3 participants