Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: randy requina
  Where is randy requina?
 Bohol, Philippines
 Philippines
 randy requina
 Tags
Subject: RE: Grid graph
Thread ID: 395806 Message ID: 395851 # Views: 82 # Ratings: 1
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Monday, January 20, 2014 12:15:34 PM         
   


> >
> >
> > You can use Shape objects, and put them in a Grid.Column, or in Container that you put beneath the Grid as your picture looks.
> >
> > The Shape.Width would indicate something like percentage, so that you could use one of the Column.Dynamic properties if it's inside the Grid, see also the sample code pasted below.
> >
> > If it's outside the Grid, Shape.Width could get determined in a place like Grid.AfterRowColChange(), which would be easy, and the Container(s) that hosts the Shape would probably need to adjust position according to resizing Forms as well as resized as well as moved Grid.Columns which can be done using BindEvent()
> >
> >
> >
> > hth
> > -Stefan
> >
> >
> >
> > LOCAL oForm as Form
> > oForm = CREATEOBJECT('TestForm')
> > oForm.Show(1)
> > RETURN
> > 
> > DEFINE CLASS TestForm as Form
> > 	AutoCenter = .T.
> > 	DataSession = 2
> > 	Width = 450
> > 
> > 	PROCEDURE Load
> > 		CREATE CURSOR temp (test I)
> > 		RAND(-1)
> > 		INSERT INTO temp VALUES ( 50 )
> > 		LOCAL i
> > 		FOR i = 1 TO 20
> > 			INSERT INTO temp VALUES ( INT(RAND()*100) )
> > 		ENDFOR
> > 		GO TOP IN temp
> > 	ENDPROC
> > 
> > 	ADD OBJECT grdTest as Grid WITH ;
> > 		ColumnCount = 2, Width = 450, Height = 250
> > 	PROCEDURE grdTest.Init
> > 		WITH This.Column2 as Column
> > 			.NewObject('cntShape','GridShape')
> > 			.cntShape.Visible = .T.
> > 			.CurrentControl = 'cntShape'
> > 			.DynamicFontBold = 'This.Column2.cntShape.DynamicWidth(temp.test)'
> > 			.Sparse = .F.
> > 			.Width = 300
> > 		ENDWITH
> > 	ENDPROC
> > ENDDEFINE
> > 
> > DEFINE CLASS GridShape as Container
> > 	PROCEDURE DynamicWidth(tnPercent)
> > 		This.shpOne.Width = This.Parent.Width / 100 * m.tnPercent
> > 		RETURN .T.
> > 	ENDPROC
> > 
> > 	ADD OBJECT shpOne as Shape WITH ;
> > 		BackColor = RGB(255,0,0), ;
> > 		Width = 0
> > ENDDEFINE
> > 

>
> Hi sir stefan,
> Thanks for the post.

You are welcome.


> Still the same format to apply with my attached datas? Its complicated because i had already the table then the sample you code is showing how to graph only without using the value in the table. can you give sample fit to the data i attached. Thanks.
>
> Regards,
> Randy


The example uses a "test" column of an alias named "temp" and the "DynamicWidth" method of the "GridShape" class assumes that column contains a ready-to-use percent value.

Your requirement might mean that two columns would have a percent result, something like "3.16 * 100 / 4", or "actual * 100 / target", which could either be a single "calculated column" in some SQL result set or two parameters sent to DynamicWidth() among other options.

FWIW, if you actually want to attach data instead of a picture, you'd need to make an effort to add a "Create Cursor myData ..." line and a few "Insert Into ..." lines in your posting so that if readers want to help you, they would not have to do too much of your work



hth
-Stefan

ENTIRE THREAD

Grid graph Posted by randy requina @ 1/20/2014 7:32:40 AM
RE: Grid graph Posted by David Mustakim @ 1/20/2014 7:38:40 AM
RE: Grid graph Posted by randy requina @ 1/20/2014 7:51:13 AM
RE: Grid graph Posted by Stefan Wuebbe @ 1/20/2014 7:53:30 AM
RE: Grid graph Posted by randy requina @ 1/20/2014 8:43:27 AM
RE: Grid graph Posted by Stefan Wuebbe @ 1/20/2014 12:15:34 PM
RE: Grid graph Posted by randy requina @ 1/23/2014 9:43:20 AM
RE: Grid graph Posted by David Mustakim @ 1/23/2014 10:01:27 AM
RE: Grid graph Posted by Vilhelm-Ion Praisach @ 1/21/2014 9:48:19 AM
RE: Grid graph Posted by Stefan Wuebbe @ 1/21/2014 10:44:06 AM
RE: Grid graph Posted by Vilhelm-Ion Praisach @ 1/21/2014 11:06:06 AM
RE: Grid graph Posted by randy requina @ 2/22/2014 9:31:54 AM
RE: Grid graph Posted by Tore Bleken @ 1/21/2014 10:08:52 AM
RE: Grid graph Posted by Paul Gibson @ 1/21/2014 12:50:09 PM