plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Range slider emits relayout evt on mousemove, should be only on mouseup

Open gregorybleiker opened this issue 8 years ago • 8 comments

I have had the need to do something after the rangeslider had changed (update the min/max somewhere else on the page). I did not find any event that fired only after the slider had been released (a.k.a. mouseup) so I changed the rangeslider/draw.js:

function mouseUp() {
            dragCover.removeEventListener('mousemove', mouseMove);
            dragCover.removeEventListener('mouseup', mouseUp);
            Lib.removeElement(dragCover);
// --> new code
            gd.emit('plotly_rangesliderend', {
                axis: axisOpts,
                opts: opts
// --> end new code
            });

Is this anything that would be merged? Should I do a PR?

gregorybleiker avatar Dec 19 '17 10:12 gregorybleiker

Hmm. That's interesting. One can already detect range slider updates by listening to plotly_relayout.

Can ask in what context a range-slider-specific event might become useful?

etpinard avatar Dec 19 '17 13:12 etpinard

plotly_relayout fires permanentyl during drag (I'd have to debounce). Actually, I oversimplified the example. Based on the range slider of one graph several other graphs get updated, so it would be really bad to be doing that continuously during draging.

gregorybleiker avatar Dec 19 '17 14:12 gregorybleiker

plotly_relayout fires permanentyl during drag (I'd have to debounce)

Hmm. That might be a bug here. It should only fire on mouseup (just like regular zoombox dragmoode: 'zoom' interactions).

etpinard avatar Dec 19 '17 15:12 etpinard

Does anyone found a workaround for this (until it gets fixed)? I need to know what the range is once mouseup

Rapster avatar Apr 15 '19 12:04 Rapster

is there any plans to resolve this bug? Or is there a current workaround??

NixTheMan avatar Nov 20 '20 14:11 NixTheMan

We need this as well. Using the range slider currently fires too many events.

MeMeMax avatar Jun 24 '21 12:06 MeMeMax

The bug is still current as of latest Plotly. There is no easy way that I am aware of to:

  • prevent relayouts while dragging the rangeslider
  • get a callback on mouseup only

cariacou avatar Jan 28 '22 05:01 cariacou

Has this been resolved, having the same problem years later! If not, does anyone recommend another library?

czanbaka avatar Jul 19 '22 17:07 czanbaka

Hi, I would also like to see this bug resolved, it would be amazing to add a "debounce" option on the range slider, so that it will only perform an update after mouseup

jonasvdd avatar Jan 14 '23 18:01 jonasvdd