Fix f32 precision loss for high-rate datetime axes (issue #487)

AL
2mo ago
+525-184

Aiming to fix https://github.com/reflex-dev/xy/issues/487 and as requested by @Alek99 am submitting thisPR which is just a copilot attempt at a fix and is not tested or reviewed properly, sorry! I am just trying to get the bug fixed but have very limited time to contribute properly.

Calendar timestamps (~1.7 × 10¹² ms since epoch) exceed f32's ~2²⁴ integer precision budget, causing the shader to collapse every timestamp within a ~200 s window to the same pixel column — producing the quantised, gapped rendering seen with high-rate time-series data.

Summary by CodeRabbit

  • Bug Fixes
    • Improved chart positioning and coordinate mapping for linear axes, especially with large values such as millisecond timestamps.
    • Increased numerical precision during pan and zoom to preserve accurate pixel spacing and endpoint placement.
    • Improved rendering consistency across bars, lines, areas, ribbons, funnels, meshes, rectangles, segments, and points.
    • Improved handling of zero, very small, degenerate, and invalid axis ranges.
    • Preserved coordinate transformation behavior for nonlinear axes, including logarithmic scales.
    • Improved bar edge placement when axis boundaries fall outside the valid domain.