Skip to content

Finance traces create a range slider by default but don't clear it on deleteTraces #1473

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
alexcjohnson opened this issue Mar 14, 2017 · 6 comments
Milestone

Comments

@alexcjohnson
Copy link
Collaborator

ohlc_first.json says nothing about a range slider, it was just created by default. So there are two pieces to this:

  1. the data is gone from the graph, it should disappear from the range slider too. If you delete any but the last trace, the range slider does update correctly, but not when you delete the last one.
  2. should the range slider itself be removed when all data is gone from it? Perhaps, perhaps not, though I discovered this because there's a test in the workspace that expects it will disappear...

@etpinard the first part is a clear bug, what do you think about the second part though?

@alexcjohnson alexcjohnson added the bug something broken label Mar 14, 2017
@etpinard etpinard self-assigned this Mar 14, 2017
@etpinard
Copy link
Contributor

should the range slider itself be removed when all data is gone from it?

My gut feeling says no.

Plotly.newPlot('graph', [{
}], {
  xaxis: {rangeslider: {}}
})

currently outputs

image

which looks right, a range slider can exist without data attach to it.

I believe I used the word orphan to describe trace-less cartesian axes. That concept sounds extendable to range slider too.

@etpinard
Copy link
Contributor

But @alexcjohnson in #289 (comment) regarding the orphan logic wrote:

but given the convoluted logic that can arise I'm starting to think it's clearer for everyone if orphan subplots are simply not drawn.

so maybe my gut feeling is wrong.

@alexcjohnson
Copy link
Collaborator Author

No, I think your gut feeling is right - when you make a plot with no data but an explicit range slider, it should show up. I could imagine someone building an application that starts out looking like this and then gets data added to it, and they might think it looks better this way than with the range slider appearing with the first data, so they should have that option.

My concern was that addTrace and then deleteTrace does not get you back to where you started, as the range slider doesn't disappear. But that's starting to seem like it's too complicated for what is frankly a strange edge case. The only place I'm worried about it still is in the workspace, if someone makes a chart that automatically creates a range slider, then decides they don't want that trace type and deletes it, then doesn't know how to get rid of the range slider. But perhaps it's better to worry about that in the workspace, as it's really only an issue there, rather than add more complexity here.

@etpinard
Copy link
Contributor

My concern was that addTrace and then deleteTrace does not get you back to where you started, as the range slider doesn't disappear.

Correct. But that's only the case for ohlc and candlestick traces at the moment. So yeah I'd call that an edge case. Still, there might be a (clean and easy) way to make:

Plotly.plot(gd, [])

Plotly.addTraces(gd, [{
  type: 'ohlc',
  /* */
]})

Plotly.deleteTraces(gd, [0])

remove the slider. I'll investigate.

@etpinard
Copy link
Contributor

the data is gone from the graph, it should disappear from the range slider too. If you delete any but the last trace, the range slider does update correctly, but not when you delete the last one.

fixed in #1472

Renaming this issue to reflect item 2

should the range slider itself be removed when all data is gone from it? Perhaps, perhaps not, though I discovered this because there's a test in the workspace that expects it will disappear...

@etpinard etpinard changed the title Range sliders don't disappear when you delete the trace that auto-created them Finance traces create a range slider by default but don't clear it on deleteTraces Mar 14, 2017
@etpinard etpinard removed their assignment Mar 14, 2017
@etpinard etpinard removed the bug something broken label Oct 4, 2018
@etpinard etpinard added this to the v2.0.0 milestone Oct 4, 2018
@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

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

No branches or pull requests

3 participants