ZoomPercent doesn't work properly in FormShow

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
ADV
Newbie
Newbie
Posts: 2
Joined: Fri Apr 30, 2004 4:00 am

ZoomPercent doesn't work properly in FormShow

Post by ADV » Wed Feb 28, 2007 10:56 am

Hello!

In FormShow, i fill a chart with three series (left axis : values, bottom axis : DateTime).
At the end i call UndoZoom. This shows the chart correctly.
But if i call ZoomPercent right after that (still in FormShow), both axis display zeros along the axis and of course no data in the chart.

If i don't call ZoomPercent in FormShow, but later in a button's click event, it is working.

Can you reproduce this?

Using BCB 5 and TeeChart 7.0.7

Thanx and kind regards,
EH

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 28, 2007 12:12 pm

Hi EH,

This is because the chart hasn't been drawn yet, you should make a Draw method call before ZoomPercent. The code below works fine for me here.

Code: Select all

void __fastcall TForm1::FormShow(TObject *Sender)
{
	Series1->FillSampleValues();
	Series2->FillSampleValues();
	Series3->FillSampleValues();

	Series1->XValues->DateTime = true;

	Chart1->Draw();
	Chart1->ZoomPercent(50);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	Chart1->ZoomPercent(50);
}
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

ADV
Newbie
Newbie
Posts: 2
Joined: Fri Apr 30, 2004 4:00 am

Post by ADV » Thu Mar 01, 2007 7:43 am

Thanx, this works :D
I recently switched from 7.0.0 to 7.0.7. In 7.0.0, Draw() was not necessary in 7.0.0.
I didn't find a note in the release notes. So now, i'm not sure,
whether there are further fundamental changes in the behaviour of 7.0.7 compared to 7.0.0.
Is there anything else i have to pay attention or change :?:

Kind regards,
EH

Post Reply