' WKSPLOT by BJ Gleason
' Plot a column of number from
' a spreadsheet
dim y(80)
oldscr=screen
Input "SpreadSheet File [WKSPLOT]";wks$
if wks$="" then wks$="wksplot"
print "Range can only be one-dimensional"
print "Columns A-Z, Rows must be 2 digits"
Input "Range i.e., A01.A80 ";rc$ : rc$=ucase$(rc$)
cs=asc(mid$(rc$,1,1))-65
ce=asc(mid$(rc$,5,1))-65
rs=val(mid$(rc$,2,2))-1
re=val(mid$(rc$,6,2))-1
if cs=ce then
  rc=true
  j=cs
  n=re-rs
else
  rc=false
  j=rs
  n=ce-cs
endif
Input "Bar or XY ";type$
for i=0 to n
if rc then
  y(i)=wksread(wks$,i+rs,j)
else
  y(i)=wksread(wks$,j,i+rs)
endif
  if i=0 then high=y(i) : low=y(i)
  if y(i) > high then high=y(i)
  if y(i) < low then low=y(i)
  print y(i),
next i

screen 6
p=240/(n+1)
w=p-2
h=62/high
if type$ = "B" or type$ = "b" then
  for i=0 to n step 2
    line(i*p,63)-(i*p+w,63-y(i)*h),1,BF
  next i
  for i=1 to n step 2
    line(i*p,63)-(i*p+w,63-y(i)*h),1,B
  next i
else
  for i=1 to n
    line((i-1)*p,63-y(i-1)*h)-(i*p,63-y(i)*h),1
  next i
endif
wait
screen oldscr
if isrun then run "menu" else end
