home *** CD-ROM | disk | FTP | other *** search
- *GRAPHS.PRG
-
- erase
-
- chkevent()
-
- @ 24,0
-
- declare ttle[10]
- declare nums[10]
- declare num2[10]
- declare lbl[2]
- declare pies[5]
- declare pilbl[5]
-
-
- *This first bit of code creates some dummy data for the three graph types.
- *Normally, you would use FILL ARRAY to extract the data from a real
- *data base.
- *
- *Create dummy data for the PIE chart
-
- store 1 to count
- do while count <= 5
- pies[count] = count
- pilbl[count] = 'Sect '+str(count,1)
- inc count
- enddo
-
- lbl[1] = 'Actual'
- lbl[2] = 'Projected'
- store 1 to count
- mdate = {01/15/89}
-
- *Create dummy data for bar and line graphs.
- *The bar and line graphs will have ten elements
-
- do while count <= 10
- *dummy numbers for both line and bar graph
- nums[count] = count * 11.25
- *dummy numbers for line graph
- num2[count] = nums[count] + 50
- *Titles for both bar and line graph
- ttle[count] = substr(cmonth(mdate),1,3)
- inc count
- mdate = mdate + 30
- enddo
-
- *Set picture frame sets the bounding rectangle in which the
- *graph is drawn. If there is no set picture frame command
- *active, the entire window is used.
- set picture frame to 5,10,21,70
-
- *Here is a BAR GRAPH
- *Syntax is
- *draw bargraph [HORIZONTAL <expC>] [VERTICAL <expC>] arrayN, arrayC
-
- draw bargraph horizontal 'Months' vertical "Sales" nums,ttle
- @ 0,0
- set message to 'Press any key or click the mouse to continue'
- wait ' '
-
- erase
- @ 22,0
-
- *Here is a PIE CHART.
- *Syntax is
- *draw piechart [HORIZONTAL <expC>] [VERTICAL <expC>] arrayN, arrayC
-
- draw piechart horizontal 'Months' pies, pilbl
- set message to 'Press any key or click the mouse to continue'
- wait ' '
- erase
- @ 22,0
-
- *This next graph is a LINE graph
- *Syntax for line graph is
- *draw graph [HORIZONTAL <expC>] [VERTICAL <expC>] arrayN[,arrayN2 ...arrayN10]
- * , arrayLable, arrayTitle
- *There should be one element in array label for each of arrayN - arrayN10
- *Each of arrayN1 through arrayN10 is a line of data points. In this case
- *we have two, nums and num2
-
- set picture frame to 5,5,21,75
- draw graph horizontal 'Months' vertical "Sales" nums,num2,ttle,lbl
-
- wait 'About to draw on the printer. Click the close box to not print the graph.'
-
-
- *Set the frame to the entire window
- set picture frame to
-
-
- set device to printer
- set printer to graphics
-
- *Note that set picture frame issued AFTER set printer to graphics
- *A FRAME created a SCREEN device is not used for the PRINTER device.
-
- set picture frame to 5,10,21,70
-
- draw bargraph horizontal 'Months' vertical "Sales" nums,ttle
- eject |Required to get the spooler to spit out a page
-
- draw piechart horizontal 'Months' pies, pilbl
- eject
-
- draw graph horizontal 'Months' vertical "Sales" nums,num2,ttle,lbl
- eject
-
- set device to screen |Don't leave the device to printer
- set printer to 1 |And turn the spooler off
-
- *Reset the frame to the entire window
- set picture frame to
-
-
-