Full BASIC has no exclusive command which draws sectors.
To draw a sector, we approximate the sector with a polygon, assign all the coordinates of vertices to a two -dimensional array, and apply a MAT PLOT statement.
The following program draw a sector graph.
We use the fact that the coordinates of the point rotated clock-wise by θ from the top of the unit circle are (sinθ, cosθ).
A sector is approximated with a 1002-gon.(1001 points are used for an ark.)
100 DATA "東京", 1257 110 DATA "神奈川",879 120 DATA "埼玉",705 130 DATA "千葉",605 140 DATA "茨城",297 150 DATA "群馬",202 160 DATA "栃木",201 170 DECLARE EXTERNAL PICTURE sector 180 SET WINDOW -1,1,-1,1 190 SET AREA STYLE "HATCH" 200 LET t=0 210 DO 220 READ IF MISSING THEN EXIT DO:s$,n 230 LET t=t+n 240 LOOP 250 RESTORE 260 LET a=0 270 LET i=0 280 DO 290 LET i=i+1 300 SET AREA COLOR i 310 SET AREA STYLE INDEX MOD(i-1,6)+1 320 READ IF MISSING THEN EXIT DO:s$,n 330 LET d=n/t*360 340 DRAW sector(a,d,s$) 350 LET a=a+d 360 LOOP 370 END 1000 EXTERNAL PICTURE sector(a,d,s$) 1010 OPTION ANGLE DEGREES 1020 DIM p(0 TO 1001, 2) 1030 FOR i=0 TO 1000 1040 LET t=a+d*i/1000 1050 LET p(i,1)=SIN(t) 1060 LET p(i,2)=COS(t) 1070 NEXT i 1080 LET p(1001,1)=0 1090 LET p(1001,2)=0 1100 MAT PLOT AREA:p 1110 SET TEXT JUSTIFY "CENTER","HALF" 1120 SET TEXT BACKGROUND "OPAQUE" 1130 PLOT TEXT ,AT SIN(a+d/2)*0.8, COS(a+d/2)*0.8:s$ 1140 END PICTURE
This is the composition rate of the population of 7 prefectures.
Total population of all prefectures is worked out in lines from 200 to 240.
Sectors that are in proportion to the population are drawn reading the population again in lines from 250 to 360. Numerical values are converted as to the total is 360.
The external picture sector(a,d,s$) draws a sector of angles from a° to (a+d)° in the clock-wise measure starting the top of the circle, and the label designated by s$.
Supplement Another example "sector.bas" lies in the "SAMPLE" folder.