Page 1 of 1

Graph Functions Library

PostPosted: Fri Feb 15, 2013 8:27 pm
by Jeff Barnes
Hi,

Does anyone know of a decent library for generating graphs on the screen that will work with xHarbour/FWH ?
I'm looking for something that can handle about 250,000 data points on the Y axis so scaling/scrolling would need to be available.

Re: Graph Functions Library

PostPosted: Sat Feb 16, 2013 10:24 am
by aferra

Re: Graph Functions Library

PostPosted: Sun Feb 17, 2013 12:53 am
by Jeff Barnes
Thanks Aferra. I will take a look at it.

Re: Graph Functions Library

PostPosted: Wed Feb 20, 2013 8:35 pm
by James Bott
Jeff,

Have you looked at the TGraph class that comes with FW?

Regards,
James

Re: Graph Functions Library

PostPosted: Wed Feb 20, 2013 9:45 pm
by Jeff Barnes
Hi James,

I haven't looked at that yet...

I'm doing a complete re-write of an older app. One part of the app took data from a medical device (one data point every second) over a 12 hour period. I used LineTo() and MoveTo() to draw the line graph. Now I am looking at doing the same type of graph but over 72 hours.

When I used the LineTo and MoveTo the code I needed to create was just massive. I had to have different display ranges (1 min, 5 min, 15 min, 60 min and the entire data set). I also had to allow the user to page through the data. It was labor intensive and I was looking for an easier way to do it :oops:

Re: Graph Functions Library

PostPosted: Wed Feb 20, 2013 11:03 pm
by James Bott
Jeff,

You can most of this very easily with TGraph. You just need to define the parameters of the graph (e.g. Line type, grids, legends) and feed it the data. This will be much simpler than what you were doing. The only coding would be to do a manual paging which I think you can do by just substituting an new data range for each time the user presses a button to go forward or backward.

The only issue you will have is the Y-axis range. TGraph auto scales it but It always starts at zero, so depending on your data range this can become a real issue. However, there is hope. There are some links in this thread

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=22687

pointing to a modified version of TGraph that supposedly allows setting of the y-axis range. I have been meaning to look at it, but haven't done it yet.

Coincidentally, I have been using TGraph for a medical data graphing system (blood pressures). For this app, the Y range has not been a problem.

Regards,
James

Re: Graph Functions Library

PostPosted: Wed Feb 20, 2013 11:16 pm
by Jeff Barnes
Hi James,

My Y axis will be values from 40 to 100. So I hope it won't be an issue...

As for the X axis, this is the one where my data will be around 250,000 data points (I made a typo in my original post saying it was the Y axis with the large data).
The X axis will be time in the format of hh:mm:ss ... can TGraph handle this?

Re: Graph Functions Library

PostPosted: Thu Feb 21, 2013 12:16 am
by James Bott
Jeff,

>The X axis will be time in the format of hh:mm:ss ... can TGraph handle this?

I think so. My chart is also using time on the x-axis but I have been just letting the chart plot it one point per interval even though my times are not the same interval (they could be 5 times in one day, and zero in the next).

However, yours are one data point per second and thus all the intervals are the same so it should work fine for you. I don't know about labeling the increments in time format though. That could be a physical space issue too since each label is eight characters wide and I don't know if it handles vertical labels. I'm not even using labels on the x-axis on mine.

If you want to email me a sample list of data (say 25 points), I will see if I can put together a quick chart for you.

jbott at compuserve dot com

Regards,
James