How can I set boundaries for zooming so that it doesn't look like this:

This picture was taken while I zoomed by mouse...
I want to beware that the user can draw the red-colored zooming area over the left-axis...
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Code: Select all
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Chart1.Zoom.Allow := PtInRect(Chart1.ChartRect,Point(X,Y));
end;
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Chart1.Canvas.UnClipRectangle;
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Chart1.Canvas.ClipRectangle(Chart1.ChartRect);
end;
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
One way would be to fill the rect after the Chart has been zoomed as in the following code :+) Is there a possibility that after zooming the zoom-brush-color is still visible in the zoomed area??
Code: Select all
procedure TForm1.Chart1BeforeDrawAxes(Sender: TObject);
begin
if zoom then
with Chart1.Canvas do
begin
Brush.Color:=clgreen;
Brush.Style:=bsSolid;
FillRect(Chart1.ChartRect);
zoom := false;
end;
end;
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
zoom:=true;
end;
Setting :+) I only can zoom from left to right direction. That means that my mouse-down-position have to be smaller than my mouse-up-position when I want to have a zooming effect.
When I want to zoom from right to left...the zoom has no effect...should mean that the chart will not zoomed. Is there a possibility to zoom also from right to left in my chart??
I'm not sure if I undestand what you want, bcos onze you have zoomed an area of the Chart, even the zoom ends to the maximum axis value (on mouse up), no other axis values will be seen (greater than the max axis value). But in any case, you can customize the axis scales in the OnZoom event, setting a new min and max (using SetMinMax method), change the increment, etc...+)In cases where I have further values 'behind' the left or right axis (for e.g.: I have values from t:=0secs. to t:= 30secs. and my chart show only a part from t:= 10secs. to t:= 20secs.). When my zooming-brush-area reaches the left (10secs.) or right axis (20secs.) I want to see also the values which are lower 10secs. or higher 20 secs. depends on my zooming direction??!!