Animated zoom doesn't zoom selected place

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Technicon
Newbie
Newbie
Posts: 43
Joined: Thu Aug 11, 2016 12:00 am
Contact:

Animated zoom doesn't zoom selected place

Post by Technicon » Mon Nov 14, 2016 7:40 am

Hello,

Animated zoom doesn't zoom selected place when direction is set to both and animation step is above 5. It just miss selected area.

TeeChart version 2016.19

Best Regards,
Grzegorz

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Animated zoom doesn't zoom selected place

Post by Yeray » Mon Nov 14, 2016 2:14 pm

Hello,

I'm not able to reproduce the problem here with the following simple example:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.Legend.Visible:=false;
  Chart1.View3D:=false;

  for i:=0 to 3 do
    Chart1.AddSeries(TFastLineSeries).FillSampleValues;

  Chart1.Zoom.Animated:=true;
  Chart1.Zoom.AnimatedSteps:=6;
  Chart1.Zoom.Direction:=tzdBoth;
end;
Could you please modify it so we can reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Technicon
Newbie
Newbie
Posts: 43
Joined: Thu Aug 11, 2016 12:00 am
Contact:

Re: Animated zoom doesn't zoom selected place

Post by Technicon » Tue Nov 15, 2016 6:30 am

Hello

I found the reason of the problem. It is because OnAxisZoom I try to zoom custom axis but i forgot to check if it's custom axis and set Min,Max for all axis.

Code: Select all

	for(int i=0; i<Chart->SeriesCount(); ++i)
	{
		if(Chart->Zoom->Direction == tzdBoth || Chart->Zoom->Direction == tzdHorizontal)
		{
			if(Chart->Series[i]->HorizAxis == aCustomHorizAxis)//<-----------I forgot to check that it's custom
			{
				TChartAxis* pTCustomHorizontalAxes = Chart->Series[i]->GetHorizAxis;
				if(pTCustomHorizontalAxes)
				{
					double aMin = pTCustomHorizontalAxes->CalcPosPoint(Chart->Zoom->X0);
					double aMax = pTCustomHorizontalAxes->CalcPosPoint(Chart->Zoom->X1);
					pTCustomHorizontalAxes->Automatic = false;
					pTCustomHorizontalAxes->SetMinMax(aMin,aMax);
				}
			}
		}

		if(Chart->Zoom->Direction == tzdBoth || Chart->Zoom->Direction == tzdVertical)
		{
			if(Chart->Series[i]->VertAxis == aCustomVertAxis)//<-----------I forgot to check that it's custom
			{
				TChartAxis* pTCustomVerticalAxes = Chart->Series[i]->GetVertAxis;
				if(pTCustomVerticalAxes)
				{
					double aMin = pTCustomVerticalAxes->CalcPosPoint(Chart->Zoom->Y0);
					double aMax = pTCustomVerticalAxes->CalcPosPoint(Chart->Zoom->Y1);
					pTCustomVerticalAxes->Automatic = false;
					pTCustomVerticalAxes->SetMinMax(aMin,aMax);
				}
			}
		}
	}
So it's my fault, but I don't understand why there was no problem when animation was off. It look like Chart->Zoom->X0,X1,Y0,Y1 have different values when one switch animation on/off.

Best Regards,
Grzegorz

Post Reply