REM > Graph
      REM Graph FPTP and STV result for Sheffield Council
      :
      max%=20:ys%=12:y0%=64:x0%=1989:xs%=48-4
      DIM data%(max%),last%(max%):last%=-1
      in%=OPENIN"..\Election\PRExample."
      REPEATUNTILLEFT$(GET$#in%,4)="----"
      REPEATUNTILLEFT$(GET$#in%,4)="----"
      REPEAT
        A$="  "+GET$#in%
        IF LENA$>5 THEN
          FOR col%=0 TO max%
            data%(col%)=VALLEFT$(A$,6)
            A$=MID$(A$,7)
            IF(col%AND1)=0:A$=MID$(A$,2)
          NEXTcol%
          FOR col%=1 TO max%
            axis%=(data%(0)-x0%)*xs%
            IF last%=-1:last%=axis%:last%()=data%()
            clr%=VALMID$("030301010404020200000505",col%*2-1,2)
            IF clr% THEN
              GCOL 0,clr%
              MOVE last%,last%(col%)*ys%+y0%
              PLOT 21-(col%AND1)*16,axis%,data%(col%)*ys%+y0%
            ENDIF
            GCOL 0,0:MOVE axis%-12,48:VDU5:PRINTFNd0(data%(0),2):VDU4
          NEXT col%
          last%=axis%
          last%()=data%()
        ENDIF
      UNTILEOF#in%
      xc%=29-(data%(0)-x0%)DIV2
      PRINTTAB(xc%,0);"Comparison of FPTP and STV votes for Sheffield City Council"
      PRINTTAB(xc%,1);STRING$(59,"=")
      PRINTTAB(xc%+16,2);"FPTP"SPC(12)"STV"
      MOVE (xc%+21)*16,916:PLOT 1,100,0
      MOVE (xc%+36)*16,916:PLOT 17,100,0
      CLOSE#in%
      *ScreenSave Graph.bmp
      END
      DEFFNd0(A%,N%)=RIGHT$("00000000"+STR$A%,N%)
      DEFFNd(A%,N%)=RIGHT$("        "+STR$A%,N%)