3 Axis Bar Chart

Date: 198x
Type: Program
Platform(s): TS 2068

Draws a 3D bar chart with solid bars.

Appears on

Library tape of the Chicago Area Timex Users Group.

Gallery

3 Axis Bar Chart

Source Code

  100 REM 3 axis chart with solid bars
  110 REM z=(4+2*COS (x/20))*(y/10+1)
  115 INK 6: PAPER 1: BORDER 2: CLS 
  120 LET cx=128: LET cy=16
  130 LET dx1=10: LET dy1=5
  140 LET dx2=8: LET dy2=4
  150 REM Draw x,y grid
  160 GO SUB 400
  165 REM Draw chart
  170 FOR x=100 TO 0 STEP -20
  180 FOR y=90 TO 0 STEP -15
  190 LET z=INT ((4+2*COS (x/20))*(y/10+1))
  195 REM Draw bar
  200 GO SUB 500
  210 NEXT y
  220 NEXT x
  230 STOP 
  390 REM x,y grid subroutine
  400 FOR x=0 TO 100 STEP 20
  410 PLOT cx+x,cy+x/2
  420 DRAW -100,50
  430 NEXT x
  440 FOR y=0 TO 90 STEP 15
  450 PLOT cx-y,cy+y/2
  460 DRAW 110,55
  470 NEXT y
  480 RETURN 
  500 REM Bar drawing subroutine
  505 REM Draw face of bar
  510 FOR n=0 TO z-1
  520 PLOT cx+x-y,cy+x/2+y/2+n
  530 DRAW dx1,dy1
  540 NEXT n
  545 REM Erase side of bar
  550 INVERSE 1
  560 FOR n=0 TO z-1
  570 PLOT cx+x-y,cy+x/2+y/2+n
  580 DRAW -dx2,dy2
  590 NEXT n
  600 INVERSE 0
  605 REM Draw side of bar
  610 PLOT cx+x-y,cy+x/2+y/2
  620 DRAW -dx2,dy2
  630 DRAW 0,z
  640 DRAW dx2,-dy2
  650 DRAW 0,-z
  655 REM Erase top of bar
  660 INVERSE 1
  670 FOR n=0 TO dx2-1
  690 PLOT cx+x-y-n,cy+z+(x+y+n)/2
  700 DRAW dx1,dy1
  710 NEXT n
  720 INVERSE 0
  725 REM Draw top of bar
  730 PLOT cx+x-y,cy+x/2+y/2+z
  740 DRAW dx1,dy1
  750 DRAW -dx2,dy2
  760 DRAW -dx1,-dy1
  770 DRAW dx2,-dy2
  780 RETURN 
  998 SAVE "3AXIS" LINE 1: STOP 
  999 OUT 244,1: MOVE "3DAXIS.BAS",1

People

No people associated with this content.

Scroll to Top