leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.51k stars 371 forks source link

How to programatically know if the chart is locked or not? (it was clicked having cursor.lock = true)? #892

Closed lucianbaciu closed 6 months ago

lucianbaciu commented 6 months ago

I want to apply different logic on the chart when it is locked or not. Can I get this state from the chart? Thank you.

leeoniya commented 6 months ago

i try to use equivalent underscore-prefixed properties for the current state vs the original option. for this it's u.cursor._lock. it's not always the case though (e.g. series.show).

i would like to introduce more consistency around this in v2

lucianbaciu commented 6 months ago

Sounds good. is this state changing all the time on click? or it is has the same value during clicks. cursor.lock says if the chart should lock/unlock on clicks. I need a way to check if the chart is locked/unlocked in a particular moment (after the first click it should be true (the moment when you disable hooks) - and after the second click it should go to false). I mentioned it again to make sure we are talking about the same thing. Thank you!

leeoniya commented 6 months ago

i understood your original question and answered it above.