Freezes when the values are close to a decimal number, like 2.70000006

#1135 · closed · 4 comments

View on GitHub ↗

ad8e

numAxisSplits tries to count the number of ticks in a range, using `(max - rounded(min)) / incr` However, `rounded(min)` can be much smaller than `min`. This causes the tick count to be larger than expected. In my setting, a smoothing algorithm caused the values to hover around 2.7, which created a lot of ticks and froze the page. I don't know what the correct fix is. My Claude suggested a few ways, but they look like bandaids. It was fixed for y axes by https://github.com/leeoniya/uPlot/commit/6a3de08db3976fb0348f9ee57839f85599748b35 Here's a repro for x axes: [x-zoom.html](https://github.com/user-attachments/files/29327341/x-zoom.html)

Comments

leeoniya

> It was fixed for y axes by https://github.com/leeoniya/uPlot/commit/6a3de08db3976fb0348f9ee57839f85599748b35 yeah, this fix works for auto-ranging but not for explicitly-set ranges. i'm not sure what the right fix is here, either. the float math gets wonky at these magnitudes and that requested scale range is not attainable anyways. <img width="464" height="134" alt="Image" src="https://github.com/user-attachments/assets/936ea059-8cec-4452-8599-060e01dce42b" /> i think the only reasonable / simple thing to do here is nope-out of the setScale call, and ignore it? > In my setting, a smoothing algorithm caused the values to hover around 2.7, which created a lot of ticks and froze the page. can you post your dataset and the zoomed scale range here?

ad8e

[uplot-tick-totality-repro.html](https://github.com/user-attachments/files/29349829/uplot-tick-totality-repro.html) This was my repro, pre-https://github.com/leeoniya/uPlot/commit/6a3de08db3976fb0348f9ee57839f85599748b35. One thought is that the y-tick text has no signal when the range is so small: it's just "2.7 2.7 2.7..." So the tick display could be made non-standard. I don't have the right fix in mind yet though.

leeoniya

> This was my repro, pre-https://github.com/leeoniya/uPlot/commit/6a3de08db3976fb0348f9ee57839f85599748b35. so would it be correct to say that you're not encountering this issue in real-world use when you swap to latest build from `master`? https://github.com/leeoniya/uPlot/blob/master/dist/uPlot.iife.min.js

ad8e

That's right. I currently don't have any x-axes with the same behavior. So I'm not affected.