[Top]

Using the SM2DGraphView Framework


Open Source License issues

Be sure to read and abide by the license accompanying this distribution. The license explicitly states what you can and cannot do; it more or less boils down to this: wherever you have your copyright info (such as an About box or Credits screen in the application, or a page of legalese in your documentation) you need to also place the following text.

SM2DGraphView Copyright © 2002-2009 Snowmint Creative Solutions LLC
http://www.snowmintcs.com/

Link to the Framework

You need your application to link to the SM2DGraphView framework. First, make sure that the framework is installed on your development machine. See the installation section of GettingStarted for a description of how to do that.

Then within your own project use the Project->Add Frameworks... menu command from Xcode. Navigate to your ~/Library/Frameworks/ folder (if that's where you installed the framework) and select the SM2DGraphView framework.

Very Important Note !!!

For backwards compatibility with older versions of Mac OS X, link to the proper configuration of the framework ("10.1 Min", "10.2 Min", or "10.4 Min"). Your own application will be able to run only as far back as that operating system.

Make a graph or three

Usually, you will use Interface Builder to put a graph or pie chart into a nib file. Hook up your dataSource object, and possibly a delegate object; they can be the same object. You can also create a graph or pie chart in code using the -initWithFrame: method. Then implement the required methods of the SM2DGraphDataSource protocol in your data source class for graphs, or the required methods of the SMPieChartDataSource protocol for pie charts.

Embedding the framework in your app

In order for your end users to have access to the graph view code at run time, either a) they will need to install the SM2DGraphView.framework on their computer, or b) you need to embed the SM2DGraphView.framework in your application. This section details how you do go about embedding the framework in your application. This discussion assumes you are using Xcode; if you're using a different build system you'll need to figure out how to do these things in your development environment.

  1. You should already have an application that works and makes use of the SM2DGraphView framework. Pretty obvious, huh?

  2. Build the SM2DGraphView framework with one of the "Deploy-Embed" build styles in Xcode. Note: Depending on what version of the framework you link to ("10.1 Min", "10.2 Min", or "10.4 Min") your own application will be able to run only as far back as that system.

  3. If you are not already copying other frameworks into your app, you will need to add a Copy Files build phase to your application target.
    To do this in Xcode, in your project's Groups & Files list disclose the Targets item; then disclose your application target. Select the application target item, then use the Project menu to make a new Copy Files build phase.

  4. In the Copy Files build phase, choose to copy the files into the Frameworks folder of your target.

  5. Add the framework to the Copy Files phase. Show the framework in the files list of your project, then drag it from there into the Copy Files build phase.

The next time you build your application, the SM2DGraphView.framework should be copied into it. You can check this by going to the Finder, selecting your application, then using the "Show Package Contents" option from the context menu (control-click or right-click to show the context menu). Inside the Contents folder of your application should be a folder named Frameworks, and the SM2DGraphView.framework should be within it.


Drawing lines in a graph - aka "being a dataSource"


© 2002-2009 Snowmint Creative Solutions LLC (Last Updated 2009-04-13)