Polar Series Zoom

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
stoyan
Newbie
Newbie
Posts: 6
Joined: Wed Oct 27, 2004 4:00 am

Polar Series Zoom

Post by stoyan » Wed Feb 21, 2007 10:57 am

Hi Guys,

I have read a lot of posts stating that the Polar Series cannot be zoomed. I looked in the Examples application Tee6New.exe and I found if one selects the Tab -> All features and then Chart Styles->Extended->Polar (Click on polar) it is possible to Zoom the Chart shown on the right. How can this be done in a C++ Application?

Thanks a lot,

Stoyan

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 Feb 21, 2007 11:56 am

Hi Stoyan,

You can try using ZoomRect, for example:

Code: Select all

void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift,
	  int WheelDelta, TPoint &MousePos, bool &Handled) 
{
	if(WheelDelta > 0)
	{	
		Chart1->ZoomRect(Rect(Chart1->Axes->Bottom->CalcXPosValue(0)+5,	
			Chart1->Axes->Left->CalcYPosValue(Chart1->Axes->Left->Maximum)+5,	
			Chart1->Axes->Bottom->CalcXPosValue(Chart1->Axes->Bottom->Maximum)-5,
			Chart1->Axes->Left->CalcYPosValue(0)-5));
	}

	if(WheelDelta < 0)
	{	
		Chart1->ZoomRect(Rect(Chart1->Axes->Bottom->CalcXPosValue(0)-5,	
			Chart1->Axes->Left->CalcYPosValue(Chart1->Axes->Left->Maximum)-5,	
			Chart1->Axes->Bottom->CalcXPosValue(Chart1->Axes->Bottom->Maximum)+5,
			Chart1->Axes->Left->CalcYPosValue(0)+5));
	}
}
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

stoyan
Newbie
Newbie
Posts: 6
Joined: Wed Oct 27, 2004 4:00 am

Post by stoyan » Wed Feb 21, 2007 3:18 pm

Hi Narcís,

Thanks a lot for the prompt response. It worked just fine :D There is one more thing to be done: Is there a way to move the Graph around. As it is done in the example which i ment. For example clicking on it an moving it to the left side of the Window, so that when I do a zooming, I can zoom only the part which is seen on the screen.
Thanks again.

Stoyan

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 Feb 21, 2007 3:33 pm

Hi stoyan,

At this topic you'll find how to implement TTeeCommander's functionality at run-time. This is a TeeChart for .NET example but the same applies for the VCL version.
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

stoyan
Newbie
Newbie
Posts: 6
Joined: Wed Oct 27, 2004 4:00 am

Post by stoyan » Wed Feb 21, 2007 3:49 pm

Hi Narcis,

Cool. Thanks a lot. It works :P


Wish you a pleasant day,

Stoyan

stoyan
Newbie
Newbie
Posts: 6
Joined: Wed Oct 27, 2004 4:00 am

Post by stoyan » Wed Feb 21, 2007 5:31 pm

Hei again Narcis,

I have another complicated problem with the polar series: When zooming with ZoomRect() the surrounding circle does not zoom. See the attached photos. Image and Image

Do you have any clue what could be the problem. I am using Teechart 6


Thanks again,

Stoyan

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

Post by Narcís » Thu Feb 22, 2007 8:33 am

Hi Stoyan,

I'm afraid the images you posted are not visible here. Could you please check it again? You should post them to some server (even it's a free imaging server) and past the URL with an image tag.

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

stoyan
Newbie
Newbie
Posts: 6
Joined: Wed Oct 27, 2004 4:00 am

Post by stoyan » Thu Feb 22, 2007 8:50 am

Hei again Narcis,

I have another complicated problem with the polar series: When zooming with ZoomRect() the surrounding circle does not zoom. See the attached photos.

Image

And when Zoomed....

Image


Sorry for that. I hope now they can be seen.

Thanks for your time,

Stoyan

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

Post by Pep » Mon Feb 26, 2007 1:58 pm

Hi Stoyan,

in order to zoom Polar Series correctly you would have to use similar code to the following :

Code: Select all

uses teCanvas,Math;

{$R *.dfm}

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  oldY:=y;
  mousedown := true;
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var tmp  : Double;
    tmp2 : Double;
begin
  Chart1.View3D:=true;
  if mousedown then
    with Chart1.View3DOptions do
      begin
        tmp:=(10.0*(OldY-Y)/TeeDistance(Chart1.ChartWidth,Chart1.ChartHeight));

        tmp2:=(10.0*tmp*ZoomFloat/100.0);
        if tmp>0 then
           ZoomFloat:=ZoomFloat+Math.Max(1,tmp2)
        else
        if tmp<0 then
           ZoomFloat:=Math.Max(1,ZoomFloat+Math.Min(-1,tmp2));
      end;
      OldY:=Y;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  mousedown := false;
end;

Post Reply