Post by Rod on Apr 12, 2019 6:31:08 GMT -5
And this is a simple way to move your chart inside the graphicbox by setting offsets. Scales and graduations can all be drawn in a similar way.
Redrawing the graphics is how I would handle it. I have not seen code that manipulates the scrollbars. I think we all shy away from them.
'set up some dummy x,y data in a points() array
dim points(2,1000)
for n= 1 to 1000
degree=degree+1 mod 360
y=sin(degree/57.29577951)*300+300
points(1,n)=n 'x
points(2,n)=y 'y
next
nomainwin
WindowWidth = 600
WindowHeight = 600
UpperLeftX = (DisplayWidth-WindowWidth)/2
UpperLeftY = (DisplayHeight-WindowHeight)/2
button #1.exit, "Exit", [Quit], UL, 500, 460
button #1.print, "Print", [PrintChart], UL, 500, 400
graphicbox #1.g, 50,80,500,300
open "Chart" for window_nf as #1
#1 "trapclose [Quit]"
#1.g "down ; fill white ; flush bak ; size 4"
'chart a hundred or so positions
for m= 100 to 200
'put point m in middle of chart
offsetx=250-points(1,m)
offsety=150-points(2,m)
' draw the chart
#1.g "discard ; cls; color red"
for n=1 to 1000
if n=m then #1.g "color blue"
#1.g "set ";points(1,n)+offsetx;" ";points(2,n)+offsety
if n=m then #1.g "color red"
next n
next m
wait
[PrintChart]
'to print the full chart draw it without offsets
#1.g "discard ; cls; color red"
for n=1 to 1000
if n=m then #1.g "color blue"
#1.g "set ";points(1,n);" ";points(2,n)
if n=m then #1.g "color red"
next n
#1.g "flush"
#1.g "print 1000"
wait
[Quit]
close #1
end
Redrawing the graphics is how I would handle it. I have not seen code that manipulates the scrollbars. I think we all shy away from them.