I am looking for a way to draw a line chart with a lot of dots (up to 10,000) effectively on iOS. The graph receives real-time data and needs to be updated several times per second. I am trying to find a way to draw a graph efficiently so that it does not maximize the processor and block the main thread while drawing.
I am currently creating a UIBezierPath for a line chart, in a background thread, adding all the dots and drawing it in CALayer (with asynchronous drawing enabled). It is not very fast, maximizes the processor, and the drawing is so slow that the user interface becomes lagging. I plan the data in real time, and theoretically I can use the same UIBezierPath every time and just add new points, however old values are discarded after a while, that is, points for deleted values should be deleted from Bezier, which is impossible.
I haven’t found anything in effectively building large datasets on iOS, but I hope there are ways to use the GPU to improve performance.
source share