C-63 Pie Chart

Developer(s): Warren Fricke
Date: 1990
Type: Program
Platform(s): TS 2068
Tags: Graphics

A model pie chart for the TS2068, written as a tutorial so you can put in your own items and amounts. It reads seven expense items and their dollar values from DATA, draws a near-round pie (line 50 holds a correction factor so the circle is not squashed on the TS2040 printout), draws the sector radii and labels each sector with the item’s initials. The second screen lists the items and amounts with a total under the heading EXPENSES of the WIDGIT COMPANY.

The program also shows how to join two screen dumps into one printout: it STOPs at lines 180 and 400 so you can get the TS2040 printer ready; CONTINUE then does the COPY. Delete the STOPs and the chart builds up on paper automatically. To chart your own figures, change the DATA in line 500 and the item counts in lines 20, 30, 100 and 300.

Published in Sinc-Link July-August 1990 (Pie Charts and Multiple Screen Dumps).

Related Articles

In this monthly contribution, I want to demonstrate in particular the capability of the TS2068 for constructing PIE CHARTS from a given set of values.

Related Content

Image Gallery

Source Code

2 REM ** MODEL of a PIE CHART
3 REM ** "C-63", 10-7-87, WF
5 REM ** UPPER BORDER
7 DRAW 0,175: DRAW 255,0: DRAW 0,-175
10 REM ** IDENTIFY and          EVALUATE ITEMS
20 DIM q$(7,15): DIM r$(7,5): LET T=0
30 FOR a=1 TO 7: READ q$(a): READ r$(a): LET T=T+VAL r$(a): NEXT a
40 REM ** UNDISTORTED CIRCLE
50 LET n=1.23: REM Cor. Factor
60 FOR a=0 TO 2*PI STEP .02
70 PLOT 127+n*80*COS a,92+80*SIN a: NEXT a
80 REM ** DRAW SECTOR RADII
90 LET a=0: REM Starting Angle
100 FOR p=1 TO 7
110 LET a=2*PI*VAL r$(p)/T+a
120 FOR R=0 TO 80
130 PLOT 127+n*R*COS a,92+R*SIN a
140 NEXT R: NEXT p
150 REM ** IDENTIFY SECTORS
160 PRINT AT 5,18;"S";AT 7,8;"I";AT 9,7;"OS";AT 15,11;"R";AT 17,18;"U";AT 13,22;"JS";AT 11,27;"D"
170 PRINT AT 20,1;"SECTORS are";AT 20,21;"identified"
175 PRINT AT 21,1;"by the INITIALS of the ITEMS."
180 STOP : COPY : CLS
255 REM ** LIST ITEMS & AMOUNTS
260 PRINT AT 1,2;"ITEM";TAB 20;"DOLLARS"
270 PRINT OVER 1;AT 1,2;"____";AT 0,20;"_______": PRINT
300 FOR a=1 TO 7
310 PRINT 'TAB 2;q$(a);TAB 22;r$(a): NEXT a
323 PRINT AT 16,19;"__________"
325 PRINT AT 18,4;"Total..........";T
330 PRINT AT 20,1;"EXPENSES of the WIDGIT COMPANY"
340 PRINT OVER 1;AT 20,1;"______________________________"
350 REM ** LOWER HALF BORDER
360 PLOT 0,175: DRAW 0,-175: DRAW 255,0: DRAW 0,175
400 STOP : COPY
500 DATA "Salaries","40563","Insurance"," 4160","Office Supplies"," 4918","Rent","25001","Utilities","14987","Janitor Serv."," 8026","Depreciation"," 2898"

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.