I just wrote a program to show the output in graph (from the data generated from my good-old Clipper/xHarbour+gtwvw program!!!). So my clients can use it as an add-on. Here is the code for it.
I created two arrays aSer which is array of series, ay which contains y values.
I started to write the code from Graph_3 of samples folder. So, it's basically a modified demo. But, modification is so much that I want to share it with all of you.
Code: Select all
Function GenerateGraph(aSer, ay, mGraphTitle)
Define Window GraphTest ;
At 0,0 ;
Width 640 ;
Height 480 ;
Title "Graph" ;
MODAL ;
BackColor { 255 , 255 , 255 } ;
On Init DrawGraph ( 1, aSer, ay, mGraphTitle )
@ 415, 20 label lblGraphtype value "Graph Type:" TRANSPARENT
@ 415, 120 combobox cboGraphtype ;
items {"Bars", "Lines", "Points"} ;
value 1 ;
on change DrawGraph(this.value, aSer, ay, mGraphTitle)
@ 415, 500 button cmdPrint caption "Print" ;
Action PRINT GRAPH OF GraphTest PREVIEW DIALOG
End Window
GraphTest.Center
Activate Window GraphTest
Return
Procedure DrawGraph ( mGraphType, aSer, ay, mGraphTitle )
ERASE WINDOW GraphTest
if mGraphtype = 1
DRAW GRAPH ;
IN WINDOW GraphTest ;
AT 20,20 ;
TO 400,610 ;
TITLE mGraphTitle ;
TYPE BARS ;
SERIES aSer ;
YVALUES ay ;
DEPTH 15 ;
BARWIDTH 15 ;
HVALUES 5 ;
SERIENAMES {"Sale"} ;
COLORS { {128,128,255} } ;
3DVIEW ;
SHOWGRID ;
SHOWXVALUES ;
SHOWYVALUES ;
; //SHOWLEGENDS ;
NOBORDER
elseif mGraphtype = 2
DRAW GRAPH ;
IN WINDOW GraphTest ;
AT 20,20 ;
TO 400,610 ;
TITLE mGraphTitle ;
TYPE LINES ;
SERIES aSer ;
YVALUES ay ;
DEPTH 15 ;
BARWIDTH 15 ;
HVALUES 5 ;
SERIENAMES {"Sale"} ;
COLORS { {128,128,255} } ;
3DVIEW ;
SHOWGRID ;
SHOWXVALUES ;
SHOWYVALUES ;
; //SHOWLEGENDS ;
NOBORDER
else
DRAW GRAPH ;
IN WINDOW GraphTest ;
AT 20,20 ;
TO 400,610 ;
TITLE mGraphTitle ;
TYPE POINTS ;
SERIES aSer ;
YVALUES ay ;
DEPTH 15 ;
BARWIDTH 15 ;
HVALUES 5 ;
SERIENAMES {"Sale"} ;
COLORS { {128,128,255} } ;
3DVIEW ;
SHOWGRID ;
SHOWXVALUES ;
SHOWYVALUES ;
; //SHOWLEGENDS ;
NOBORDER
endif
Return
Please advise how to improve the graph generation software.
With best regards.
Sudip