FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TGraph - setting the scale
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TGraph - setting the scale
Posted: Tue Oct 18, 2011 02: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TGraph - setting the scale
Posted: Mon Jan 28, 2013 06:01 PM

Dear James,
did you resolve it?
bye
marco

Marco Boschi
info@marcoboschi.it
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: TGraph - setting the scale
Posted: Mon Jan 28, 2013 06: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TGraph - setting the scale
Posted: Mon Jan 28, 2013 06: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 March-April 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: TGraph - setting the scale
Posted: Mon Jan 28, 2013 07: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TGraph - setting the scale
Posted: Mon Jan 28, 2013 07: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

Marco Boschi
info@marcoboschi.it
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: TGraph - setting the scale
Posted: Mon Jan 28, 2013 10:53 PM
Hola

a work around can be
Code (fw): Select all Collapse
...
DATA nMax INIT 0
...


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

Code (fw): Select all Collapse
   // 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
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
Re: TGraph - setting the scale
Posted: 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
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: TGraph - setting the scale
Posted: Wed Jan 30, 2013 10:42 AM

OK
MANY THANKS


:):):):):)

Marco Boschi
info@marcoboschi.it
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: TGraph - setting the scale
Posted: Thu Feb 14, 2013 03:27 PM

Marco,

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

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: TGraph - setting the scale
Posted: Thu Feb 14, 2013 06:10 PM

hallo,
can you post a samples of tgraph use?
thanks

FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: TGraph - setting the scale
Posted: Wed Feb 20, 2013 09: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion