Pre-release of a graphing framework

Discussion in 'Mac Programming' started by phjo, Apr 9, 2008.

  1. macrumors regular

    Joined:
    Jan 8, 2008
    #1
    Hi,

    Although it is far from being complete, I put online a pre-release of the plotting framework I am writing for objective-c (targetted at 10.4 and 10.5 osx).

    There is almost no documentation yet, but the behavior is easy to understand from reading the headers.

    Any comment is welcome, in this thread or by emailing me.

    You'll find it there : http://www.mpkju.fr/~graphview

    phjo
     
  2. macrumors member

    cruzrojas

    Joined:
    Mar 26, 2007
    Location:
    USA
    #2
    Hey, this might be useful for me, I will give it a try and let you know what I think.

    Thank you for sharing.
    Jesus Cruz
     
  3. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #3
    Please do !

    Some documentation (class tree) has now been added,

    phjo
     
  4. macrumors newbie

    Joined:
    Mar 5, 2008
    #4
    Wow this is wierd just today I have been looking for a Graphing framework and you release on yesterday...

    THANKS!
     
  5. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #5
    You're welcome,

    I warn you though, it is a work in progress, and under active development. As it is not yet a couple of weeks old, it might change quite a bit in the near future, beginning with the names of methods that do not conform to cocoa guidelines... (I am a beginner in cocoa programming and learning a lot in the process...)

    Names of classes and some instance variables are not definitive either, as I intend to get rid here or there of some abbreviations.

    Maybe PHxAxis, PHyAxis will be renamed PHHorizontalAxis and PHVerticalAxis in the same process.

    So be prepared for some changes in the near future...

    Please report your experience with this framework, here or through email, as can be found in the project website.

    phjo
     
  6. macrumors member

    Joined:
    Apr 10, 2008
    #6
    Thanks for the lib

    will this lib work on iPhone?
     
  7. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #7
    I have absolutely no idea... But nothing prevents you from trying to build it for the iphone...

    Some new changes today : the code has been cleaned up a bit, fixed a bug or two, and changed the mouse event handling to make it closer to cocoa guidelines.

    So a right click (or command+left click) now shows a contextual menu with the possibility to copy to the pasteboard in tiff, eps or pdf formats. A zoom out is performed with option+right click.

    phjo
     
  8. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #8
    Three new classes (GraphObjects) for axis drawing inside the view, lines, and plotting real valued functions graphs have been added. New screenshots, examples are at the same location.

    phjo
     
  9. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #9
    What does PH stand for?
     
  10. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #10
    I'd assume it's his name - look at the bottom of the page above :)
     
  11. macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #11
    That is nice. Something for scientists. I am also working (on and off) on a plotting library for scientific use, so I am quite interested :)
    What kind of license is it under? I didn't find anything about it. (EDIT: it's under the download section.)
    --
    edit:

    "PHOverlayWindow.?" is unfortunately missing in the xcode project.
    I have a few questions and remarks, if I may.

    Suppose you have a list of plots (each plot having multiple objects that are plotted) in an selectable NSTableView lets say. Whatever the user selects is shown on the screen. How would your code or you handle that? Replace the view with a new view or simply erase the old plot and redraw the new plot on screen. I think this question is important as in to where you store variables such as minimum and maximum axis values or plot labels. Is it stored within the framework, or is it something a delegate or datasource has to handle and the framework merely asks for it (which is my approach btw).

    The graphobjects you plot are not optional, it seems. That is a plot can not be defined and the display of it can be toggled on or off (toggling between on and off is a very important option I would say).

    What is the range of values your code can handle? The latest problem I ran into was representing decimals as floats.

    How does CG compare to the cocoa drawing functions? Are they much faster, or more complicated?
     
  12. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #12
    Licence is for now MIT, although I didn't do that much thinking about that yet, I just wanted something fair and not restrictive. It could change (as many other things) in the future, but I wouldn't go all the way to a strict GPL licence I guess.

    The MIT licence is one of the downloads.

    And Kainjow is of course right, I was not very imaginative with the initials of the classes...

    As you tackled writing a plotting framework as well, MrFusion, I'm quite interested with your suggestions for the development of this framework...

    In a few days or rather weeks, I'll try to choose a repositery on line (google code ? sourceforge ?) and of course, if some developers want to be part of the project at one point, the help will be quite welcome.

    The next step though would be to have a mailing-list to discuss development (not only bug reports of course, but new features, UI, naming, design decisions...)

    phjo
     
  13. macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #13
    Yes, I found it just now. Sorry about that.

    I do the same. But it works, doesn't it. :)

    Now that I know the license of your code, I am more than happy to share my "code" with you. What would be the best way?

    Sounds good.
     
  14. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #14
    You were right, MrFusion, about the PHOverlayWindow... I have no idea what happened actually. I've uploaded I hope this time the entire project. Bug me if not.

    As concerns drawing or not an object, adding a flag for that would be nothing at all, and meanwhile it could be done, but it is a bit tedious while removing adding back the object to the array of objects to be drawn.

    if it is an important improvement, I'll gladly add the very few lines necessary... (In PHGraphObject implementation of course)

    As for changing the entire plot, I am not sure what the best approach would be yet, but I think a tabless NSTabView could do the trick ?

    there is no label yet, but it is planned and my approach would be to include them in the graph objects themselves (not the view).

    And finally, if you are interested in taking part in this project, first thing would be to send me an email so that I don't lose track of you, and as soon as it has a mailing list I can inform you (or even enlist you without further warning !)

    phjo
     
  15. macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #15
    Nah, don't bother. Do it when you have some spare time. I know it's only a few lines and can easily do it myself. It was just something you shouldn't forget. Maybe I will add when you get that repository running. :)

    No it wouldn't, I am afraid. Not for me at least. For example, one 15 minute experiment gives me roughly 4000 plots of raw data. One of the reason I started coding myself.
     
  16. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #16
    Then maybe the best way would be to add accessors to the three arrays defining the content of a PHGraphView, and switching plots would just mean changing the arrays and display the view. That would be very fast, and with a low memory footprint.

    phjo
     
  17. macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #17
    I appreciate your concern for a low memory footprint. :) I can't wait for the new iMac (Apple when are going to update it) to replace my mini, because I want to play around with the instruments etc.

    As to your suggestion. Speaking from a user point of view. A plot is much more that simply data. It can also have different axis ranges, different number of graphobjects, different labels, different colors for the graphobjects, different legend, etc.

    To illustrate, my list of delegate and datasource functions is longer than my list of actual plot routines. Maybe that is just a sign of bad design, I don't know. I do know that it al depends on how much customisability you want to give to user, on how complex the plotting is. Making all the choices for the user is easier, let the user decides every minute detail can be long and tedious work. In contrast, for example making the code decides the best interval for the tics can be hard to do for a wide range of possible values, as you might have noticed. However it is easier to just leave it to the user, although once again you get a long list of delegate functions.

    Anyway, your code looks much better than my and the result is already nice. It's a good start I would say.

    PS. I hope you got my email.
     
  18. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #18
    I am aware of that, and this is exactly what I meant with the PHGraphView content, which is not that big because graph objects only keep references to their data.

    Customisability always comes at a price, but my approach is to try adding whatever customisation is suitable while keeping reasonable defaults, enabling users getting graphs in not so many lines of code.

    The algorithm I used there for tickmarks is quite simple, but will need some refinement later on. (Especially as concerns the tick values, which could overlap in some cases.)

    User defined tickmarks is now possible as well (although mostly will be ignored for logarithmic scales, whose implementation as regards tick marks is very preliminary...)

    phjo
     
  19. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #19
    A new object (parametric curve) has been added, along with the creation of a mailing list.

    I urge you to subscribe to that list so that :
    - you can guide the project for it to be suitable for as many users as possible (you don't have to contribute a line of code for that, but if you want to code, that will soon be possible too...)
    - I don't have to speak to myself, and getting bored

    phjo
     
  20. macrumors newbie

    Joined:
    Oct 20, 2008
    #20
    Porting to iPhone

    I too would like to port this graphing library to iPhone but I don't know how to build a framework specifically for that.

    Has anyone else done this?

    Thanks!
     
  21. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #21
    You can't use third party frameworks on the iPhone. The only way to do it would be to include all the relevant files from the framework in your project directly. Just make sure you are not violating the license of the framework first though.
     
  22. thread starter macrumors regular

    Joined:
    Jan 8, 2008
    #22
    Well, my applications TouchPlot and TouchPlotLite (see http://www.mpkju.fr/~touchplot ) use part of this framework, quite substantially modified though.

    The licence (bsd like) allows it.

    As for frameworks in the iPhone, it would probably be possible to embed a framework in the application bundle but it might not be allowed then for appstore distribution.

    So what Cromulent suggests is safer and easier too, and is what I did myself.

    I will probably, sooner or later, pull back some of the changes I made coding touchplot to my graphing framework, but it is at the moment far down in my to do list.

    phjo
     
  23. macrumors newbie

    Joined:
    Oct 20, 2008
    #23
    Thanks for the prompts reply!

    I started porting the code over last night. I just added a new group to my project and then added the files to that. I'm also using TouchXML so I set it up similar to that.

    I replaced the cocoa.h with

    Code:
    #if defined(TARGET_IPHONE_SIMULATOR) || defined(TARGET_OS_IPHONE)
    #import <uikit/uikit.h>
    #define NSColor UIColor
    #define NSRect CGRect
    #define NSSize CGSize
    #else
    #import <cocoa/cocoa.h>
    #endif
    But I'm still getting plenty of warnings and errors that I need to sort out. I'm new to iPhone but have plenty of .net and RoR experience. I'm finding it a little tricky to find out what the equivalents for the iPhone are.

     
  24. macrumors newbie

    Joined:
    Oct 20, 2008
    #24
  25. macrumors newbie

    Joined:
    Feb 28, 2008
    #25

Share This Page