Skip to content

Range slider data update fix #1350

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
wants to merge 3 commits into from
Closed

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Feb 1, 2017

fixes https://github.com/plotly/streambed/issues/9088

A very subtle change that ensures that new range slider ranges are computed under data array restyle/addTraces/expandTrace/deleteTraces updates.

- instead of `(!rangeslider.range)`-based criterion
- which allows for data update to correctly expand the range slider
- rm now useless axis.autorange criterion for _needsExpand
@etpinard etpinard added status: reviewable bug something broken labels Feb 1, 2017
@etpinard etpinard added this to the 1.23.0 milestone Feb 1, 2017
@@ -82,7 +82,7 @@ module.exports = function(gd) {
// compute new slider range using axis autorange if necessary
// copy back range to input range slider container to skip
// this step in subsequent draw calls
if(!opts.range) {
if(axisOpts._needsExpand && axisOpts._min.length && axisOpts._max.length) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the computed range slider range (i.e. opts.range here) is copied to the user layer container, Axes.getAutoRange would not get called on data array updates (unless one would delete gd.layout.xaxis.rangeslider.range).

Note that xaxis._min and xaxis._max are only defined when an update call passed through the calc step as setConvert clears them here in supplyDefaults.

xaxis: { rangeslider: { range: [-1, 11]} }
})
.then(function() {
assertRange([-0.13, 2.13]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit confusing, as it looks like this test is identical to the previous one until you squint at the details of assertRange. Nonblocking, but I might have made it explicit by saying assertRanges([-0.13, 2.13], [-1, 11]) or something.

@alexcjohnson
Copy link
Collaborator

💃

@etpinard
Copy link
Contributor Author

etpinard commented Feb 2, 2017

This fix doesn't work for soon-to-be-added multiple range sliders #1250. I'm working on a better solution, possibly by adding rangeslider.autorange boolean attribute.

@etpinard etpinard removed this from the 1.23.0 milestone Feb 6, 2017
@etpinard
Copy link
Contributor Author

etpinard commented Feb 6, 2017

Dropping from the 1.23.0 milestone.

This bug fix will be part of the multiple range slider #1250 feature PR.

@etpinard etpinard closed this Feb 6, 2017
@etpinard etpinard deleted the range-slider-data-update branch February 6, 2017 14:56
@etpinard etpinard mentioned this pull request Feb 6, 2017
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 this pull request may close these issues.

2 participants