Adding FlpGrf OCX to Visual FoxPro

Viewing FoxPro Examples

Introduction

 

Visual FoxPro - My First Graph


Adding data under FoxPro 3.0.

 

If the above data where to be in a table named MyTable residing in a Database Container MyDBC, you can place it into the databuffer with a few lines of code that look like this :

 

Open database MyDBC && fill in databaseName

Select * from mytable into array aMyArray && SQL statements

 

if _tally > 0 && Any data read?
     for row = 1 to alen(aMyArray,1) && Rows
           for col = 1 to alen(aMyArray,2)
                 This.DataValue(row,col) = aMyArray[ row, col]
           next
     next
endif

 

These lines of code could be placed in the Init-property of the Control.

If you place these lines of code in some other property (for example a Commandbutton ...) the DataValue - line should look like this :

ThisForm.Graph1.DataValue(row,col)=aMyArray[row,col]

or

This.Parent.Graph1.DataValue(row,col)=aMyArray[row,col]

 

First program

 

This first program can be placed in the GotFocus Event of the FlpGrf control.

THISFORM.FlpGrf1.DataInit=2
THISFORM.FlpGrf1.GraphType=0

THISFORM.FlpGrf1.DataValue(1,0)="Jason"
THISFORM.FlpGrf1.DataValue(2,0)="Mike"
THISFORM.FlpGrf1.DataValue(3,0)="Calvin"
THISFORM.FlpGrf1.DataValue(4,0)="Bob"
THISFORM.FlpGrf1.DataValue(5,0)="Dan"

THISFORM.FlpGrf1.DataValue(1,1)=87
THISFORM.FlpGrf1.DataValue(2,1)=59
THISFORM.FlpGrf1.DataValue(3,1)=52
THISFORM.FlpGrf1.DataValue(4,1)=4
THISFORM.FlpGrf1.DataValue(5,1)=49

THISFORM.FlpGrf1.GraphEnabled = .F.
THISFORM.FlpGrf1.Column=0
THISFORM.FlpGrf1.ColumnAxis=0
THISFORM.FlpGrf1.Column=1
THISFORM.FlpGrf1.ColumnAxis=1

THISFORM.FlpGrf1.ColumnType=3
THISFORM.FlpGrf1.Graph3DRotation=20
THISFORM.FlpGrf1.GraphSwapScale=.T.

THISFORM.FlpGrf1.GraphEnabled = .T.

 images/vfp2.png



Adding FlpGrf OCX to Visual FoxPro Viewing FoxPro Examples

 

 

Last modified on: Friday, August 16, 2002