Closed thomas-coldwell closed 1 year ago
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.
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
Hey @chrispader I've tried the latest changes on main
, but this still creates NaN
s 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):
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 😄
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
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 😄