Multi-million data point charts


#1

Greetings.

I have an assignment which requires drawing graphs on iPhone and iPad that in a worst case scenario might consist of multiple millions of points.

Shinobi charts seem to be the best high performance chart drawing framework for iOS out there, however it becomes unusable at a few hundred thousand points (on iPhone4), which isn’t good enough.

It seems to me that shinobi is rendering all the points that have been passed through 

- (id<SChartData>)sChart:(ShinobiChart *)chart dataPointAtIndex:(int)dataIndex forSeriesAtIndex:(int)seriesIndex

regardless of zoom levels. And it seems to be exactly what hogs up all the performance.

Needless to say that rendering a graph consisting of million points on a device that has 640 pixel wide screen is also completely useless since all that the end user sees is basically a blob.

Is there any way I can draw, say every 1000th point out of my million point array when user is fully zoomed out, every single point when fully zoomed in and use some in-between values at other zoom levels?

Or if that isn’t possible perhaps there is a way I can gracefully swap/ insert/ remove graphs when zoom level changes without fully reloading the entire chart view and breaking interactivity?

I am fairly new to shinobi, so I could easily have missed an obvious way to do this.

Basically my question amounts to: Do I have any control over how many lines are actually rendered?/ How do I draw an interactive multi-million point chart?


#2

Hi Smerdelis,

sorry I don’t have enough experience with the framework either to give you an answer. I’d presume you’d use the chart delegate sChartDidStartZooming / sChartDidFinishZooming methods to be notified of zoom changes and adjust your data storage and / or points reported in the datasource methods. Not sure how that works with re-drawing animation though.

I’m curious where you’re getting the millions of data points from? Is that workable with an array or set? How do you manage the memory? We’re prototyping a dashboard type iPad app with a local 500k row SQLite DB and blow the stack attempting roll-up aggregate queries. We’ve switched to getting processed data online.

Cheers,

Steve


#3

I’ll give this problem another look in a few days and post the results. Suggestions are still welcome though.

As for getting data and managing memory - I will also be receiving pre-processed data from the web. Thanks to the assignment specifics the data I need basically boils down to a single array of floating point values. In order to save on network traffic and parsing on the device the data might be sent as list of floating point values in plain text i.e.:

1.7359,1.7368,1.7337,1.7317,1.7387,1.7467,1.7461,1.7366,1.7319

 and so on,which comes down to 7 bytes per value, which in turn is a significant gain over XML and a minor gain over JSON.

Data might also be sent as a list of binary floating point values, further decreasing traffic and processing required, but that clearly takes more work to set up properly. In this scenario a million points of floats only take up 4MB and can be instantly used as a c-style array without any additional processing at the receiving end.

Hope this helps you in some way, Sprior.

Smerdelis


#4

Maybe a range selector (with a reduced chart) and then display the detail chart? But i don’t know if that is possible, i never done that.

Cheers, OneCent