You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I created a line chart with Skia, which holds 2 lines with gradient below them and ref lines.
The Group component holidng these elements is animated inside of the canvas with PanGesture. The thing is, that it's lagging if I have more data points (1440 datapoints is the max I use at the moment).
So I tried to understand why it's lagging, but can't find the reason behind this. This is the part of the code responsible for animation:
With less data points there is no lag (or it's smaller)
If I remove some components from the group, the lag also gets smaller.
If I remove withTiming and just set chartX value directly with user swiping, there is also no lag.
Nothing inside of Group rerenders during the animation (which meanst that the animation IS actually running on UI thread).
Also the whole chart component doesn't rerender during the Pan swiping animation.
If I redice withTiming duration, the lag gets smaller.
I'm trying to understand where does the lag come from or how I can get rid of it. Do you have any ideas? If everything runs on UI thread, it probably shouldn't happen, no matter how many data points I have or how many components are drawn inside of Group, since they are not rerendered or redrawn while swiping.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey, I created a line chart with Skia, which holds 2 lines with gradient below them and ref lines.
The Group component holidng these elements is animated inside of the canvas with PanGesture. The thing is, that it's lagging if I have more data points (1440 datapoints is the max I use at the moment).
So I tried to understand why it's lagging, but can't find the reason behind this. This is the part of the code responsible for animation:
While checking this, I noticed a few things:
withTiming
and just set chartX value directly with user swiping, there is also no lag.withTiming
duration, the lag gets smaller.I'm trying to understand where does the lag come from or how I can get rid of it. Do you have any ideas? If everything runs on UI thread, it probably shouldn't happen, no matter how many data points I have or how many components are drawn inside of Group, since they are not rerendered or redrawn while swiping.
Beta Was this translation helpful? Give feedback.
All reactions