This framework provides an NSView subclass which draws a graph of lines and/or bars including axis labels. The SM2DGraphView class acts very much like an NSTableView or NSBrowser; SM2DGraphView takes responsibility for all of the drawing code but relies on a data source object to provide the specific lines and points to draw. A delegate object can also be assigned to a graph object to modify the behavior of the graph view.
This framework also provides an NSView subclass which draws a pie chart. The SMPieChartView class acts very much like an NSTableView or NSBrowser; SMPieChartView takes responsibility for all of the drawing code but relies on a data source object to provide the specific sizes of the pie slices to draw. A delegate object can also be assigned to a pie chart object to modify the behavior of the pie chart view.
The SM2DGraphView framework is a very easy to use graph view that should work admirably for the average non-scientific application. Neither the SM2DGraphView class nor the SMPieChartView class is thread safe; they are not coded for really high performance drawing. The SM2DGraphView class does take advantage of the Velocity Engine on G4 and G5 CPUs when working with lines containing 64 or more data points. If you need to draw lines with millions of data points, you should probably look for other alternatives.
The SM2DGraphView framework consists of two Xcode project files (one for use with the 10.4 SDK and one for the 10.5 SDK), the source code itself, this documentation, pre-built versions of the framework (which include the Interface Builder 3 plugin within them), Interface Builder 2.x palette, and sample application. The source code is broken into four parts, but is included as necessary in the Xcode projects.
The Xcode project files build a Universal Binary that supports both PowerPC and Intel architectures, and has build configurations to create frameworks that are compatible back to Mac OS X 10.1 if needed. You'll need to select which framework you use in your own project(s) depending on your target audience. I recommend using the 10_2_Min configuration or later unless you REALLY need to support 10.1; the gradient shading capabilities of bar graphs and pie charts are not present on 10.1 and will not be included for anybody (even somebody running 10.5) if you use the 10.1 config.
The code for use with the 10.5 SDK has all of the same capabilities of the 10.4 SDK code with the following additions/exceptions:
The SM2DGraphView framework and the related files in this distribution are open source. They are not public domain; they are copyright © 2002-2009 Snowmint Creative Solutions LLC. They are governed by an open source license, which is intended to allow others reasonable freedom in using and modifying the sources, while allowing Snowmint Creative Solutions LLC to retain some control over the project. If you intend to use or modify the source code for this project, you must read and follow the license. The license should be included in this distribution; if not, you can find it at <http://developer.snowmintcs.com/OpenLicense.html>.