So you want to put a graph in your application?

Graphs are great things, they’re a great way to pimp out an app (provided you are doing something data-ish). But right now there aren’t a whole lot of options when it comes to adding graph goodies too your applications if your a cocoa developer. — Not Cool. sigh.

So if you want to add graphing you have these options:

+ Apple’s GraphKit framework If you have access to the documentation then that’s the way to go. Unfortunatly that’s a little hard to come by if you’re outside of Apple. I’ve heard GraphKit almost made it public with Tiger. . . but didn’t — sigh.

+ SM2DGraphView from [Snowmint Creative Solutions]( [SM2DGraphView]( is _ok_, but I’m not too crazy about it. API doesn’t allow for for a whole lot (at least not what I wanted) and the source isn’t _that_ conducive to customization. Also I’m not too sure about how it handles ‘special’ floating point values (NaN, etc.).

+ Roll your own, Well if 1) and 2) won’t work you don’t have much of an option then… problem is making your own takes time and, well, it’s usually not worth all that time.

So what to do? well 1) and 2) didn’t work for me, and the app I was making _was_ the graph so, eh – I didn’t have much of a choice, I had to take 3).

Keeping in mind that I (as well as other people) did not want to have to go through doing number 3 again in the future, I figured I would take some extra time and start the beginnings of a decent cocoa graphing class.

The two major goals for the project:

+ Low barrier to entry, I want people to say “hey, a graph would look good here” and to be able to plug a graph right in, without having to muck around figuring out how to do all of this graphing stuff. As a consequence I’ve chosen to do a few things inefficiently (NSTableView style DataSource), but in the hope that usability will benefit.

+ Extendability/Customizability I’m not going to be able to anticipate how people will want to graph their data, so I’ve made a point of, if not implementing a functionality, (hopefully) making it easy enough to add that functionality with a subclass or thereabouts.

That was a year or so ago, since then all my code has by laying by the wayside, lonely and neglected. These past few months I figured I would dust it off a bit and do a bit more work on it.

I figure now it’s about fit for public consumption. So, if your in the mood to do some graphing eat your heart out.

[GraphX Framework]( – project page