[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-2008 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 simply use the Project->Add Frameworks... menu command from Xcode (or Project Builder). Navigate to your ~/Library/Frameworks/ folder (if that's where you installed the framework) and select the SM2DGraphView framework.

!!! Very Important Note !!!

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.

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 or Project Builder; 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 framework with one of the "Deploy-Embed" build styles in Xcode. If you're using Project Builder, simply use the Deployment build style. 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. You need to add a Copy Files build phase to your application target.

    To do this in Xcode, open the Targets outline view item in the files list of the project window, then open your application target outline view item. Select the application target item, then use the Project menu to make a new Copy Files build phase.

    To do this in Project Builder, go to the Targets tab of the project window and select your application target. Then make sure the Files & Build Phases tab is showing. Select one of the phases in the build, 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-2008 Snowmint Creative Solutions LLC (Last Updated 2008-02-15)