Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove incorrect delta from pixel factor calculation #56

Merged
merged 3 commits into from
Jan 23, 2023

Conversation

thomas-coldwell
Copy link
Member

This PR fixes an issue identified where some later dates in the points data would cause NaNs in the cubic path calculation. Once I removed the delta value for the pixelFactorX calculation the graph rendered correctly with a valid path.

I'm not fully sure I understand why this fixes it so would be great if you could shed some light here @chrispader and make sure I'm not breaking something else with this change 😄

@chrispader
Copy link
Member

I made some improvements to how all of the createGraphPath() logic is working in #52 , but i don't know if this exactly fixes your problem.

I tested your changes with the latest main branch and it seems to be very laggy for me. Not sure yet, what's causing this.

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-01-13.at.19.32.30.mp4

@chrispader
Copy link
Member

Both the pan gesture as well as initial rendering is very laggy atm, investigating this now. @thomas-coldwell would my mind trying the current changes in main with your project. Maybe the issue is fixed already

@thomas-coldwell
Copy link
Member Author

thomas-coldwell commented Jan 23, 2023

Hey @chrispader I've tried the latest changes on main, but this still creates NaNs in the cubic path calculation and thus causes no graph to be rendered when using older dates (here's the test dates I'm using if you want to try repro https://github.com/margelo/react-native-graph/pull/56/files#diff-a895e922286dc9ab015822845889d3553db8349679cf1ea63bae81ac3862a068R14-R16):

@thomas-coldwell
Copy link
Member Author

This latest change should fix the drawingFactor calculation. Prior to this change it was creating hundreds of points in-between data points hence the lag when scrubbing over the graph 😄

@thomas-coldwell thomas-coldwell mentioned this pull request Jan 23, 2023
Copy link
Member

@chrispader chrispader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@chrispader
Copy link
Member

Thanks for your help @thomas-coldwell

I definitely have to do some renaming of the variables used for the path calculation. They seem somehow misleading, but for now it looks good

@chrispader chrispader merged commit e327c9d into main Jan 23, 2023
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.

None yet

2 participants