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](http://snowmintcs.com). [SM2DGraphView](http://developer.snowmintcs.com/frameworks/sm2dgraphview/index.html) 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](http://blog.oofn.net/projects/graphx) – project page
graphx looks nice, however there is currently now way to get any data INTO the tool. Nor does it allow entry of functions. Nor is there a way to save the output in PDF.
In short it seems that you did not release version 1.0 but version .2 (.5b).
But one thing is sure, it’s very nice looking and responsive!
-John
I think there might be a misunderstanding here?
<blockquote>
graphx looks nice, however there is currently now way to get any data INTO the tool. Nor does it allow entry of functions. Nor is there a way to save the output in PDF.
</blockquote>
GraphX is a framework, meaning that it is designed for developers to use when building their own applications. The application included in the project is only meant to demonstrate the framework’s functionality.
The framework is certainly capable of doing those things you mentioned… it’s just that doing those things is sort of besides the point (in a demo)?
<blockquote>
But one thing is sure, it’s very nice looking and responsive!
</blockquote>
Appreciated!
Hi, Are there currently any issues with using this framework on an intel mac?
Code that runs fine on my PPC mac produces different results when run on my intel mac, specifically the graph seems to be drawn incorrectly.
Hi Chad,
I think i’ve found the problem with the framework. The default declaration for the Curve DataSource is:
– (float)yValueForXValue:(double)x
This causes problems on my intel iMac as the value being passed in is incorrect. Changing the declaration to
– (float)yValueForXValue:(float)x
So that all the values were float, has fixed the problem.
Still, strange that it works fine on my PPC powerbook without the change.
If you want any other details, feel free to email me.
cheers,
the outputs look great… and I see that someone else asked about how to put data into the tool…
could you provide some example code of how to use your framework?
I am interested in passing data to the framework and having it display a graph in a cocoa gui, and then updating the graph and have it reflected in the gui real-time. (in case you were wondering!)
thanks
<p>I want to echo the previous question. Is there a way to plot data real time. Say, data arriving every 1/2 second or so..?</p>