I am using iOS Charts (https://github.com/danielgindi/Charts) to visualize some data sets. I need to be able to visualize and interact with large data sets consisting of 4 million plus points. However, I am encountering significant lag when attempting to interact with the data before and after the graph renders.
At first I was having trouble displaying the data at all, but was able to find a work around by switching the chart type from a line to a scatter plot.
Now I am able to visualize the data sets but the graphs take ~30 seconds to load while the markers take about ~10 seconds each to pop up when I click on a particular area of the graph. The zoom feature is also noticeably delayed.
I have tried the features on smaller datasets and confirm they work as intended when there is less data.
The code structure is something as follows if that helps:
Populate dataPoints with X/Y coordinates
Initialize ScatterChartDataSet with dataPoints
Initialize ScatterChartData object with the set
Set graph.data equal to the data object
So by the end I want to be able to visualize ~4 million data points using Charts and enable user interactions without significant delays. Any ideas on how to speed things up? Thank you in advance!
I don't think you're going to be able to speed up the rendering when you try and plot the entire data set on the screen. It's futile anyway, because you won't see all the data points - you have 4 million points but at most only a few thousand pixels. I think you have two options:
Limit the range of visible data by using setVisibleXRangeMaximum() and let the user scroll through the data
-or-
Decimate the data points yourself down to a reasonable number of displayable points.