Page 1 of 1

Animated zoom doesn't zoom selected place

Posted: Mon Nov 14, 2016 7:40 am
by 16578912
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

Re: Animated zoom doesn't zoom selected place

Posted: Mon Nov 14, 2016 2:14 pm
by yeray
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.

Re: Animated zoom doesn't zoom selected place

Posted: Tue Nov 15, 2016 6:30 am
by 16578912
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