--- title: "Bar Graphics" id: 76323 type: "computer_media" slug: "bar-graphics" url: "http://localhost/computer_media/bar-graphics/" markdown_url: "http://localhost/computer_media/bar-graphics.md" published_at: "2026-11-11T08:03:10+00:00" modified_at: "2026-11-11T08:03:10+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/bar-graphics-1.png" excerpt: "Draw a bar chart with a grid and labelled axes on the ZX80, either from ten random values or from ten numbers you enter." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "ZX80" slug: "zx80" taxonomy: "post_tag" url: "http://localhost/tag/zx80/" model: - name: "Sinclair ZX80" slug: "zx80" taxonomy: "model" url: "http://localhost/model/zx80/" indiv: - name: "Joe Chaiet" slug: "joe-chaiet" taxonomy: "indiv" url: "http://localhost/indiv/joe-chaiet/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_type: "Program" programmers: - name: "Joe Chaiet" slug: "joe-chaiet" taxonomy: "indiv" url: "http://localhost/indiv/joe-chaiet/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Bar%20Graphics%20%281981%29%28Chaiet%2C%20Joe%29%28ZX80%29%28US%29%28Program%29.zip" mediadate: "1981" images: - url: "http://localhost/wp-content/uploads/2026/11/bar-graphics-1.png" - url: "http://localhost/wp-content/uploads/2026/11/bar-graphics-2.png" article_media: - id: 19772 title: "Bar Graphics" type: "article" url: "http://localhost/article/bar-graphics/" related_content: - id: 19761 title: "Syntax Error" type: "article" url: "http://localhost/article/syntax-error-5/" - id: 19732 title: "Dear Editor" type: "article" url: "http://localhost/article/dear-editor-23/" media_type_tags: "Graphics" license: false --- # Bar Graphics A bar-chart program for a 2K ZX80 (it was written on a 2K MicroAce and will not fit in 1K). Answer SELECT (1 OR 2) with 1 for ten random values or 2 to type ten numbers from 0 to 10. The program draws the bars in graphic characters against a dotted grid with labels on both axes. Later issues printed fixes. In May 1981 Syntax gave the missing comparison signs in line 134 (Y1), which are in this listing. In June 1981 a reader noted that lines 175 and 181 need a semicolon at the end; the printed Syntactic Sum matches the program with one on line 181, but the listing as printed has none, so each label below the chart goes on a new line. Line 155 jumps to line 98, which does not exist; the program carries on at the next line. In testing, the chart was drawn and the program then stopped with report 5 at line 180 because the labels had filled the screen. Published in Syntax April 1981 ([Bar Graphics](https://timexsinclair.com/article/bar-graphics/)). ## Source Code ``` 1 DIM U(50) 2 LET T=0 3 RANDOMISE 4 PRINT "DO YOU WANT A RANDOM GRAPH OR" 5 PRINT 6 PRINT "DO YOU WANT TO ENTER 10 NUMBERS?" 7 PRINT 8 PRINT "SELECT (1 OR 2)" 10 INPUT Z 11 IF Z>1 THEN GO TO 19 15 FOR X=1 TO 10 16 LET U(X)=RND(10) 17 NEXT X 18 GO TO 60 19 CLS 20 PRINT " THIS PROGRAM WILL PRINT A GRAPH" 21 PRINT "OF 10 NUMBERS FROM 0 TO 10" 23 PRINT 25 PRINT "ENTER" 30 FOR X=1 TO 10 40 PRINT "NUMBER ";X; 45 INPUT U(X) 46 PRINT "?"; U(X) 50 NEXT X 60 CLS 65 FOR X=1 TO 32 68 PRINT CHR$(128); 70 NEXT X 72 PRINT 75 LET X=11 80 FOR W=1 TO 10 90 LET X=X-1 91 PRINT CHR$(128); 92 PRINT CHR$(X+28+128);CHR$(2); 105 LET T=T+1 107 IF T>1 THEN PRINT CHR$(128);CHR$(128); CHR$(2); 109 FOR Y=1 TO 10 110 IF U(Y)>X THEN PRINT "▒▒"; 120 IF U(Y)=X THEN PRINT "▒▒"; 121 IF Y=10 AND T=1 AND U(Y)1 THEN PRINT CHR$(128); 140 NEXT Y 150 PRINT 155 IF T<2 THEN GO TO 98 156 LET T=0 160 NEXT W 163 PRINT CHR$(128);CHR$(128);CHR$(133); 165 FOR X=1 TO 29 166 PRINT CHR$(3); 167 NEXT X 168 PRINT CHR$(128);CHR$(128); 170 FOR X=1 TO 10 175 IF X=10 THEN PRINT CHR$(128);CHR$(U(X)+128+28);CHR$(128) 179 IF X=10 THEN GO TO 190 180 PRINT CHR$(128); 181 PRINT CHR$(U(X)+128+28);CHR$(128) 190 NEXT X 191 STOP ```