Zooming boundaries...

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Zooming boundaries...

Post by bingo72 » Wed Jan 17, 2007 2:22 pm

Hello Steema-Experts...

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

Image
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
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 17, 2007 3:48 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Wed Jan 17, 2007 4:18 pm

I have problems with the newsgroup....can you give me a mail-adress to send it simple and fast??

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 17, 2007 4:25 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Thu Jan 18, 2007 6:28 am

Hello Narcis....

I sent you the files by mail...

Best regards
Thomas

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Jan 18, 2007 7:30 am

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;
Marjan Slatinek,
http://www.steema.com

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Fri Jan 19, 2007 11:43 am

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Jan 19, 2007 1:27 pm

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;
Marjan Slatinek,
http://www.steema.com

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Fri Jan 19, 2007 2:18 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jan 19, 2007 2:55 pm

Hi Steve,

Sure, I've added your request to the wish-list to be considered for inclusion in future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bingo72
Newbie
Newbie
Posts: 42
Joined: Sun Aug 10, 2003 4:00 am
Location: Austria

Post by bingo72 » Mon Jan 22, 2007 7:11 am

Hello Marjan...

many thanks....your second tip....it helps!! That is what I want!! :lol:
3 further questions: :wink:

+) 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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jan 31, 2007 9:38 am

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...

Post Reply