Page 1 of 1
Polar Series Zoom
Posted: Wed Feb 21, 2007 10:57 am
by 9524710
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
Posted: Wed Feb 21, 2007 11:56 am
by narcis
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));
}
}
Posted: Wed Feb 21, 2007 3:18 pm
by 9524710
Hi NarcĂs,
Thanks a lot for the prompt response. It worked just fine
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
Posted: Wed Feb 21, 2007 3:33 pm
by narcis
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.
Posted: Wed Feb 21, 2007 3:49 pm
by 9524710
Hi Narcis,
Cool. Thanks a lot. It works
Wish you a pleasant day,
Stoyan
Posted: Wed Feb 21, 2007 5:31 pm
by 9524710
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.
and
Do you have any clue what could be the problem. I am using Teechart 6
Thanks again,
Stoyan
Posted: Thu Feb 22, 2007 8:33 am
by narcis
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.
Posted: Thu Feb 22, 2007 8:50 am
by 9524710
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.
And when Zoomed....
Sorry for that. I hope now they can be seen.
Thanks for your time,
Stoyan
Posted: Mon Feb 26, 2007 1:58 pm
by Pep
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;