TGraph - setting the scale

TGraph - setting the scale

Postby James Bott » Tue Oct 18, 2011 2:45 pm

Does anyone know if it is possible to set the scales of a graph programmatically? I want to set the maximum and minimum values of the Y axis. From looking at the class code, it doesn't seem possible.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TGraph - setting the scale

Postby MarcoBoschi » Mon Jan 28, 2013 6:01 pm

Dear James,
did you resolve it?
bye
marco
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: TGraph - setting the scale

Postby James Bott » Mon Jan 28, 2013 6:28 pm

Marco,

No, I never did. But I didn't really spend much time on it.

My version of TGraph is from 3/23/2008. If you have a newer version of FWH then you might have a newer version of TGraph.prg (in the source folder).

If not, then author's name and email address is in the PRG. You might contact him to see if there is a later version.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TGraph - setting the scale

Postby Silvio.Falconi » Mon Jan 28, 2013 6:42 pm

James I not understood how want make if you explain I can try to see it ..
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: TGraph - setting the scale

Postby James Bott » Mon Jan 28, 2013 7:20 pm

Silvio,

Currently TGraph figures out the max and min value for each axis based on the data. This can lead to some very odd labeling of increments. For instance the graph I am currently using shows the Y-Axis from 0 to 250 (which is actually OK), but there are only 4 increments for the labels so you get labels of 0.00, 62.50, 125.00, 187.50, 250.00. This isn't actually that bad, but it would be better divided into 5 increments so the labels would read 0, 50, 100, 150, 200, 250.

So, it would seem that the easiest way to handle this would be to allow the programmer to set the min and max of the axis and the number of increments for the labeling.

I don't need this for the x-axis right now, but I am sure it would also be useful.

Of course, it would still be useful to have it operate as it does now since you often don't know the range of the data you are processing.

Since TGraph is a very complex program capable of doing some complex graphing it would probably be best if we could get the author to add these features.

For me the changes are not a pressing need, since I have been using this chart for a couple of years now. Others may need this capability though.

I wish to thank Alfredo Arteaga, the author of TGraph for writing this awesome program. One of the very first programs I wrote almost 30 years ago, was a graphing program and it was not easy.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TGraph - setting the scale

Postby MarcoBoschi » Mon Jan 28, 2013 7:43 pm

James,
Thank you very much.
In Italy "just in time" means "I do not know what to do" "but tomorrow it must be on line"
I will try to adapt it to my need
marco
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: TGraph - setting the scale

Postby Marcelo Via Giglio » Mon Jan 28, 2013 10:53 pm

Hola

a work around can be
Code: Select all  Expand view  RUN

...
DATA nMax INIT 0
...
 


and in the paint method change ( and IF ) this lines to show like this

Code: Select all  Expand view  RUN
  // Max, Min values
      IF ::nMax != 0
      nMax := IF( ::nMaxVal <> 0 , ::nMaxVal , 0 )
      FOR nJ := 1 TO Len( ::aSeries )
          FOR nI :=1 TO Len( ::aData[nJ] )
              nMax := Max( ::aData[nJ][nI], nMax )
          NEXT nI
      NEXT nJ
   ELSE
      nMax := ::nMax
   ENDIF
 


Exactly the same for the minimums value

regards

Marcelo
Marcelo Via Giglio
 
Posts: 1071
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: TGraph - setting the scale

Postby RSalazarU » Wed Jan 30, 2013 12:29 am

Hola:
Hace tiempo publique esto:

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=19894

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=20060

y ahora acabo de actualizar el archivo http://www.sauro-sys.com/Source/tgraph.rar

Atentamente,

Rolando Salazar Ureña
http://www.sauro-sys.com
email: SauroSys@sauro-sys.com
Cochabamba-Bolivia

PD. Espero que les sirva
RSalazarU
 
Posts: 211
Joined: Wed Jul 16, 2008 12:59 pm
Location: Cochabamba-Bolivia

Re: TGraph - setting the scale

Postby MarcoBoschi » Wed Jan 30, 2013 10:42 am

OK
MANY THANKS
:) :) :) :) :)
User avatar
MarcoBoschi
 
Posts: 1066
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: TGraph - setting the scale

Postby James Bott » Thu Feb 14, 2013 3:27 pm

Marco,

Were you ever able to set the range of the Y-axis?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TGraph - setting the scale

Postby damianodec » Thu Feb 14, 2013 6:10 pm

hallo,
can you post a samples of tgraph use?
thanks
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 422
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: TGraph - setting the scale

Postby James Bott » Wed Feb 20, 2013 9:27 pm

damianodec,

>can you post a samples of tgraph use?

There is a test.prg in the TGraph file that shows a number of example graphs.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 13 guests