Skip to content

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

Open
nebojsa-peric wants to merge 1 commit into
masterfrom
hotfix/numericscale-trackvalue-constrain
Open

fix(charts): constrain the value, not the pixel, in NumericScale.trac…#1311
nebojsa-peric wants to merge 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.
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.

1 participant