Multiple graphs using Core Plot on iPad
I have an app that requires an unknown number of graphs to show, depending on how many sensors are attached to the iPad. I have X numbers of NSArrays containing X NSNumbers which are updating live; the graphs need to update along with the data (i.e. live as well).
My problem occurs when I use Core Plot. How do I create multiple graphs dynamically? I am new to Objective-C so perhaps it's just an issue with me.
If I create a graph and the corresponding delegate methods which is required to add data? Can someone give an overview of how to do this?
You can create as many graphs as you need. Make a hosting view for each one and lay them out however you want. The hosting view is a subclass of UIView so you can use all of the standard layout techniques and container views.
Depending on the look you want to achieve, an alternative is to use one graph that holds multiple plots. Create each one normally and use -addPlot: to add them to the graph.
All of your plots can share a datasource, although they don't have to. Set the identifier on each plot to a unique value. In the datasource methods, check the identifier on the plot parameter and use that to decide what data to return.