plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.82k stars 1.85k forks source link

Range Slider with multi category repositions if dragging on the gray area #6838

Open ysk3a opened 7 months ago

ysk3a commented 7 months ago

I've searched in https://github.com/plotly/angular-plotly.js if there was any issues about the range slider jumping randomly but there was not much but plotlys main repo had a few that were somewhat related but not exactly.

I've been wanting to use angular-plotly for my application since it had range slider and multi category axis with an easy api but i've noticed that when the user were to slide on the gray area to the far left or far right, the range slider would reposition to the top suddenly and would cause the x-axis to disappear. Sometimes simply dragging in the gray area would cause the repositioning and a jumpy range change. I thought maybe this was just the angular-plotly since the range slider example i copied from was https://plotly.com/javascript/range-slider/ , where there was no range slider reposition when sliding, but it appears that this jumping also happens in the vanilla js.

Reproducible Ex: https://stackblitz.com/edit/js-7ietfq?file=index.js%2Cpackage.json

start sliding in the gray area (left or right):

image

ends up after sliding:

image

my quick and toplevel guess is that the quickest temporary fix would be if somehow the library just disabled/prevent any interaction on the gray area and restrict only to using the handle bars until there is a fix?

ysk3a commented 7 months ago

after trying to look into when exactly this repositioning happens, it seems to also happen when the none gray slider area width become close to <= 0? So in addition to when i click on the gray area and drag, if i were to click on the range slider handle bar and drag it close and over the opposite range handle bar, that repositioning of the whole range slider happens. so, my guess is that similar cause when clicking+draggin the gray area since the 'new' non gray area jumped with a width of 0 or less. I am not sure if it is related to the range slider width as there was no range min attribute to test?