Page 1 of 1
Zooming boundaries...
Posted: Wed Jan 17, 2007 2:22 pm
by 8577300
Hello Steema-Experts...
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...
Posted: Wed Jan 17, 2007 3:48 pm
by narcis
Hi bingo72,
Could you please send us a simple example project we can run "as-is" and let us know the steps we should follow to reproduce the problem here and also the TeeChart version you are using?
You can post your files at news://
www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
Posted: Wed Jan 17, 2007 4:18 pm
by 8577300
I have problems with the newsgroup....can you give me a mail-adress to send it simple and fast??
Posted: Wed Jan 17, 2007 4:25 pm
by narcis
Hi bingo72,
I've sent you a forums private message with the e-mail address where you should send the project at.
Thanks in advance.
Posted: Thu Jan 18, 2007 6:28 am
by 8577300
Hello Narcis....
I sent you the files by mail...
Best regards
Thomas
Posted: Thu Jan 18, 2007 7:30 am
by Marjan
Hi.
I think in your case a simple solution would be to allow zoom only if mouse position is within a tChart.ChartRect rectangle. You could use tChart.OnMouseDown event to allow/disable zooming. Something like this:
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;
Posted: Fri Jan 19, 2007 11:43 am
by 8577300
I tried the code in my onmousedown-event....like Marjan suggested...but unfortunately I still can zoom over the orange left axis...
Any further ideas??
Bye
Thomas
Posted: Fri Jan 19, 2007 1:27 pm
by Marjan
Hi.
Ok. How about manualy clipping zooming rectangle by using tChart OnMouseMove and OnAfterDraw events ? Something like this:
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;
Posted: Fri Jan 19, 2007 2:18 pm
by 9333098
Marjan,
Wish list : could both your suggested behaviors (do not allow user to begin a zoom if they are outside the chart's inner rect and do not allow the zoom box rectangle to be dragged outside the chart's inner rect) be made a settable property of a chart ? Something like RestrictZoomToInnerRect (true/false) ?
Thanks,
Steve
Posted: Fri Jan 19, 2007 2:55 pm
by narcis
Hi Steve,
Sure, I've added your request to the wish-list to be considered for inclusion in future releases.
Posted: Mon Jan 22, 2007 7:11 am
by 8577300
Hello Marjan...
many thanks....your second tip....it helps!! That is what I want!!
3 further questions:
+) Is there a possibility that after zooming the zoom-brush-color is still visible in the zoomed area??
+) 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??
+)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??!!
Best regards
Thomas
Posted: Wed Jan 31, 2007 9:38 am
by Pep
Hi,
+) Is there a possibility that after zooming the zoom-brush-color is still visible in the zoomed area??
One way would be to fill the rect after the Chart has been zoomed as in the following code :
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;
or simply use an TColorBand Tool to draw a rectangle under the Series, specifiying the min and max of each axis.
+) 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??
Setting :
Chart1.Zoom.Direction:=tzdHorizontal;
you should be able to zoom horizontally without taking into account the pos of the mouse.
+)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??!!
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...