A gallery of Core Plot examples for Mac OS X and iOS. The iOS app is a universal app that supports both iPhone and iPad.
To add a new plot demo:
-
Create a new subclass of the
PlotItemclass. -
Add a
+(void)loadclass method to register the class via the[super registerPlotItem:self];message. This makes it show up in the tableview/imageview. -
Set the
titleandsectionin the-initmethod. Thetitleis used as the label in the list of plots, grouped alphabetically under thesection. -
Override the
-renderInGraphHostingView:withTheme:animated:method to set up the plot demo. Add the graph hosting view(s) for the demo as sublayers of the hosting view parameter. If the plot demo includes more than one graph, yourPlotItemsubclass is responsible for the layout of the graphs. Use autolayout on iOS and calculate the layout manually on the Mac. Be sure to implement the-setFrameSize:method on the Mac and update the layout there, too. See theCompositePlotclass for an example of creating multiple graphs in a plot demo. -
Call the
-addGraph:toHostingView:method to add each graph to its hosting view and to the master list of graphs. -
Implement the
-killGraphmethod to release temporary data or views created in the-renderInGraphHostingView:withTheme:animated:method. -
Add any delegate methods you need for handling labels or user interaction and datasource methods to provide plot data.