Skip to content

fix(charts): constrain the value, not the pixel, in NumericScale.trac… - #1311

Merged
mstijak merged 1 commit into
masterfrom
hotfix/numericscale-trackvalue-constrain
Jul 30, 2026
Merged

fix(charts): constrain the value, not the pixel, in NumericScale.trac…#1311
mstijak merged 1 commit into
masterfrom
hotfix/numericscale-trackvalue-constrain

Conversation

@nebojsa-peric

Copy link
Copy Markdown
Collaborator

…kValue

trackValue(v, offset, constrain) clamped the raw pixel coordinate v instead of the computed value when constrain was true, mismatching TimeScale.trackValue. With a pixel range wider than the value range, an in-range value whose pixel fell outside [min, max] was wrongly clamped.

  • Extract the private NumericScale calculator into its own React-free module so it can be unit-tested in isolation (public API unchanged; it is not re-exported from the axis barrel).
  • Add a regression test covering constrained/unconstrained trackValue.

According to claude this is a bug:
image

…kValue

`trackValue(v, offset, constrain)` clamped the raw pixel coordinate `v`
instead of the computed `value` when `constrain` was true, mismatching
TimeScale.trackValue. With a pixel range wider than the value range, an
in-range value whose pixel fell outside [min, max] was wrongly clamped.

- Extract the private NumericScale calculator into its own React-free
  module so it can be unit-tested in isolation (public API unchanged; it
  is not re-exported from the axis barrel).
- Add a regression test covering constrained/unconstrained trackValue.
@mstijak
mstijak merged commit 5b64b3c into master Jul 30, 2026
2 checks passed
@mstijak
mstijak deleted the hotfix/numericscale-trackvalue-constrain branch July 30, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants