Page 1 of 1

ZoomPercent doesn't work properly in FormShow

Posted: Wed Feb 28, 2007 10:56 am
by 9337296
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

Posted: Wed Feb 28, 2007 12:12 pm
by narcis
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);
}

Posted: Thu Mar 01, 2007 7:43 am
by 9337296
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