plotly / dash-slicer

A volume slicer for Dash
https://dash.plotly.com/slicer
MIT License
24 stars 7 forks source link

Add a rate limiter on the slicer's index #24

Closed almarklein closed 3 years ago

almarklein commented 3 years ago

Following up on #23, this PR improves the user experience by trying to keep the effect of a fast-changing index local to the current slicer. While dragging the slider, the current slicer is updated, but the other slicers (for the same scene_id) are not notified, nor will there be a request for new data to the server. When you stop dragging, the final value is "published", so the indicators update and the server provides the full-res data. This means all CPU cycles can be used to keep the current slicer responsive.

This is implemented using an Interval object that is turned on when the slider value is changed, and turned off when the value is published. The interval can be set to just 100ms so there is no perceived waiting time. Note that the behavior is pretty similar to the proposed approach in https://github.com/plotly/dash-core-components/pull/884.

In this PR:

emmanuelle commented 3 years ago

It looks like there is a problem with the CI.

almarklein commented 3 years ago

Ready for review!

emmanuelle commented 3 years ago

This looks great, feel free to merge when you want (I read the code quicky but I can read it in more details when it's merged as well, and I agree that this rate limitation mechanism is a good thing for performance).