MODE 21 DIM graphformat{bboxwidth%,bboxheight%,bboxbackcol%,bboxcol%, \ Set characteristics for the bounding box \ gwidth%,gheight%,gbackcol%,gboxcol%, \ Set characteristics for the graph area itself \ xcol%,xthick%,xmin,xmax,xdivs%, \ Set characteristics of the x axis \ ycol%,ythick%,ymin,ymax,ydivs%, \ Set characteristics of the y axis \ title$,titlecol%,titlesize%,titlex%,titley%, \ Set characteristics of the chart title \ xlabel$,xlabelcol%,xlabelsize%,xlabelx%,xlabely%, \ Set characteristics of the x axis label \ ylabel$,ylabelcol%,ylabelsize%,ylabelx%,ylabely%} : REM Set characteristics of the y axis label REM set up default values graphformat.bboxwidth%=800 graphformat.bboxheight%=600 graphformat.bboxbackcol%=15 graphformat.bboxcol%=15 graphformat.gwidth%=600 graphformat.gheight%=400 graphformat.gbackcol%=15 graphformat.gboxcol%=0 graphformat.xcol%=0 graphformat.xthick%=1 graphformat.xmin=0 graphformat.xmax=0 graphformat.xdivs%=1 graphformat.ycol%=0 graphformat.ythick%=1 graphformat.ymin=0 graphformat.ymax=0 graphformat.ydivs%=1 DIM data(11,2) REM Note: the first column (x=0) will contain the number of data points, and the n+1st will contain the data marker specification FOR x%=0 TO 10 FOR y%=0 TO 2 READ data(x%,y%) NEXT y% NEXT x% DATA 10,10,10,3,4,5,4,4,6,6,8,7,8,8,10,10,10,10,11,8,6,12,6,8,14,10,12,16,14,20,18,20,20 REM set data marker specifications: colour (0-15) + REM line style (16 x: 0=solid,1=dotted, 2=dashed, 3=broken, 4=none) + REM marker type(256 x: 0=+, 1=x, 2=dot,3=circle, 4=square, 5=none) REM marker size(65536x: 4 BB4W graphics units plus value) data(data(0,0)+1,0)=0 data(data(0,1)+1,1)=1+16*2+256*3+65536*5 data(data(0,2)+1,2)=4+16*1+256*2+65536*5 REM make a "nice" background so we can see where the graph is GCOL 128+6 CLG PROClinegraph(100,100,graphformat{},data(),3) :REM Plot a linegraph at the coordinates given, in the format specified, using the data block, showing 3 series REM OK, Let's play around a bit graphformat.bboxwidth%=400 graphformat.bboxheight%=300 graphformat.gwidth%=350 graphformat.gheight%=200 data(data(0,0)+1,0)=7+16*4+256*1 data(data(0,1)+1,1)=2+16*3+256*4+65536*3 data(data(0,2)+1,2)=3+16*1+256*5+65536*5 PROClinegraph(1000,100,graphformat{},data(),3) :REM Plot a linegraph at the coordinates given, in the format specified, using the data block, showing 3 series graphformat.bboxwidth%=1200 graphformat.bboxheight%=400 graphformat.gwidth%=1100 graphformat.gheight%=300 graphformat.bboxbackcol%=8 graphformat.bboxcol%=1 graphformat.gbackcol%=4 graphformat.gboxcol%=15 graphformat.xcol%=15 graphformat.ycol%=15 PROClinegraph(100,750,graphformat{},data(),3) :REM Plot a linegraph at the coordinates given, in the format specified, using the data block, showing 3 series END : DEFPROClinegraph(px%,py%,gform{},d(),ns%) LOCAL xoff%,yoff%,xscale,yscale,xsep,maxx%,maxy,miny,x%,y%,linestyle%,mtype%,msize% GCOL gform.bboxbackcol% RECTANGLE FILL px%,py%,gform.bboxwidth%,gform.bboxheight% GCOL gform.bboxcol% RECTANGLE px%,py%,gform.bboxwidth%,gform.bboxheight% xoff%=px%+(gform.bboxwidth%-gform.gwidth%) DIV 2 yoff%=py%+(gform.bboxheight%-gform.gheight%) DIV 2 GCOL gform.gbackcol% RECTANGLE FILL xoff%,yoff%,gform.gwidth%,gform.gheight% GCOL gform.gboxcol% RECTANGLE xoff%,yoff%,gform.gwidth%,gform.gheight% IF gform.xmin=gform.xmax THEN xsep=1:xmax=maxx%-1 miny=d(0,1) FOR y%=0 TO ns%-1 IF d(0,y%)>maxx% THEN maxx%=d(0,y%) FOR x%=1 TO d(0,y%) IF d(x%,y%)>maxy THEN maxy=d(x%,y%) IF d(x%,y%)<miny THEN miny=d(x%,y%) NEXT x% NEXT y% IF gform.xmax=gform.xmin THEN xscale=gform.gwidth%/maxx% xsep=1 xmax=maxx%-1 ELSE xscale=gform.gwidth%/(gform.xmax-gform.xmin) xsep=(gform.xmax-gform.xmin)/maxx ENDIF IF gform.ymax=gform.ymin THEN yscale=gform.gheight%/maxy ELSE yscale=gform.height%/(gform.ymax-gform.ymin) GCOL gform.ycol% LINE xoff%,yoff%,xoff%,gform.gheight%+yoff% REM add tick marks here... GCOL gform.xcol% LINE xoff%,yoff%,xoff%+gform.gwidth%,yoff% REM add tick marks here... FOR y%=0 TO ns%-1 IF d(0,y%)>1 THEN GCOL d(d(0,y%)+1,y%) MOD 16 linestyle%= (d(d(0,y%)+1,y%) DIV 16) MOD 16 CASE linestyle% OF WHEN 1:linestyle%=21 WHEN 2:linestyle%=37 WHEN 3:linestyle%=53 WHEN 4:linestyle%=0 OTHERWISE linestyle%=5 ENDCASE mtype%=(d(d(0,y%)+1,y%) DIV 256) MOD 16 msize%=4+((d(d(0,y%)+1,y%) DIV 65536) MOD 256) MOVE xoff%,yoff%+yscale*d(1,y%) FOR x%=2 TO d(0,y%) PLOT linestyle%, xoff%+xscale*(x%-1),yoff%+yscale*d(x%,y%) NEXT x% IF mtype%<5 THEN FOR x%=1 TO d(0,y%) MOVE xoff%+xscale*(x%-1),yoff%+yscale*d(x%,y%) CASE mtype% OF WHEN 0: MOVE BY -msize%,0 DRAW BY msize%*2,0 MOVE BY -msize%,-msize% DRAW BY 0,msize%*2 WHEN 1: MOVE BY -msize%,-msize% DRAW BY msize%*2,msize%*2 MOVE BY -msize%*2,0 DRAW BY msize%*2,-msize%*2 WHEN 2: CIRCLE FILL xoff%+xscale*(x%-1),yoff%+yscale*d(x%,y%),msize% WHEN 3: CIRCLE xoff%+xscale*(x%-1),yoff%+yscale*d(x%,y%),msize% WHEN 4: RECTANGLE xoff%+xscale*(x%-1)-msize%,yoff%+yscale*d(x%,y%)-msize%,msize%*2 ENDCASE NEXT x% ENDIF NEXT y% ENDPROC