Hope this is clear...
I want to know if the PaintBox control can allow the user to scroll, left to right through data? Imagine it like an oscilloscope display where a single capture allows zooming and scrolling. In this case I do not need zooming. So, my Paintbox is 800x600 and my data set is 16000x600.
I can plot in the 800x600 region as shown below, no problems at all, and can apply scaling to get all the data in, but I want to keep the Y-axis scaled to 1 and be able to scroll/drag left/right and view the data.
for J := 1 to ((Form1.Memo1.Lines.count)-1) do
begin
MyTorques[J] := StrToInt(Form1.Memo1.Lines[J]);
Tqmult := ((StrToInt(Label6.Caption) + 500) Div 600);
Ycalc[J] := ((MyTorques[J]) Div Tqmult);
InvY[J] := (600 - (Ycalc[J]));
X1 := (J-1);
Y1 := InvY[J-1];
X2 := (J);
Y2 := InvY[J];
with PaintBox1.Canvas do
begin
pen.Style := psSolid;
pen.Color := clBlack;
pen.Width := 1;
moveto(X1, Y1);
Lineto(X2, Y2);
Label51.Caption := IntToStr(X1);
Label52.Caption := IntToStr(Y1);
Label28.Caption := IntToStr(X2);
Label29.Caption := IntToStr(Y2);
Label35.Caption := IntToStr(Tqmult);
Label37.Caption := IntToStr(Ycalc[J]);
Label39.Caption := IntToStr(InvY[J]);
Label41.Caption := IntToStr(MyTorques[J]);
end;
if MyTorques[J] < Smallest Then
Begin
Smallest := MyTorques[J];
SmallestIndex := J;
end;
if MyTorques[J] > Largest Then
begin
Largest := MyTorques[J];
LargestIndex := J;
end;
Label30.Caption := IntToStr(Smallest);
Label31.Caption := IntToStr(SmallestIndex);
Label32.Caption := IntToStr(Largest);
Label33.Caption := IntToStr(LargestIndex);
end;
So, does my paintbox.canvas need to be sized 16000x600 with a "window" over the top sized 800x600, and the paintbox control is drag-able with vertical and horizontal constraints?
PaintBox by default does not have any scrolling support built in.
So if you want to have scrolling capabilities you will have to place your PaintBox into some other scrollable control like ScrollBox and set size of your PaintBox large enoought to contain rendering of your entire plot.
But this is a bad practice. Why? Doing so you will spend a lot of time painting your plot even thou only a part of it is visible to user at one time.
Instead you should be thinking of painting just part of your plot that can actually be visible by your user at the sima time (fits into PaintBox) and then redraw the plot when user scrolls to different position on a plot.