Skip to content

fix: render points sharing one date - #131

Open
huytdps13400 wants to merge 1 commit into
margelo:mainfrom
huytdps13400:fix/86-duplicate-date-points
Open

fix: render points sharing one date#131
huytdps13400 wants to merge 1 commit into
margelo:mainfrom
huytdps13400:fix/86-duplicate-date-points

Conversation

@huytdps13400

Copy link
Copy Markdown
Contributor

Summary

  • keep matching points inside a zero-duration X range
  • center the degenerate range on the canvas
  • draw every value at the shared X coordinate so Skia receives a visible vertical path

Root cause

When the first and last timestamps are equal, X normalization divides by zero. The resulting NaN causes getPointsInRange to discard every point before path creation. Even after normalizing the shared timestamp, the one-pixel sampler selects only the first point, leaving Skia with a move command but no drawable segment.

The patch maps the shared timestamp to the center of the range, rejects non-matching timestamps from an explicit zero-duration range, and preserves all same-date values at that X coordinate. The existing behavior for different dates that merely floor to one canvas pixel remains unchanged.

Validation

Using the repository Node.js version (22.20.0):

  • yarn test --runInBand — 5/5 tests pass
  • yarn typecheck
  • yarn lint — 0 errors; one existing no-shadow warning in AnimatedLineGraph.tsx
  • yarn prepare
  • git diff --check

Fixes #86

@riteshshukla04

Copy link
Copy Markdown
Collaborator

3 year old issue :)

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.

Bug: Graph not shown if at least 2 points exists with same date

2 participants