Page 1 of 1

Automatic scaling only points shown in chart

Posted: Wed Jan 31, 2007 7:39 am
by 9238722
Hi All

I have a real-time charting question.

My users can select to display only part (e.g. the last 5 minutes) of a big point series. Is it possible to make the left axis autoscale only on the points shown, or do I have to manually search for minimum and maximum within the points shown on the axis?

Any help will be greatly appriciated, Jørgen

Posted: Wed Jan 31, 2007 10:28 am
by narcis
Hi Jørgen,

Axes autoscaling works fine visualizing part of a series when using paging feature. You'll find examples in the features demo searching for page or MaxPointsPerPage. MaxPointsPerPage's default value is 0 which mean no chart paging.

The new features demo is available at TeeChart's program group.

Posted: Wed Jan 31, 2007 12:38 pm
by 9238722
Hi Narcis

I can not make your suggestion working. The code below (with one timer, one tchart and one points series) don't autoscale. The lower left axis is always -10 (the starting point)

However, the solution is also a bit difficult for me to implement as the recording frequency of my points might vary. Thus, I have to somehow count the number of points that is displayed and then everytime a point is displayed I need to change the MaxPointsPerPage.

I guees that the most easy way is to search through all the displayed points and then find min or max?

Regards Jørgen


TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Chart1->MaxPointsPerPage = 100;
Series1->AddXY(Now(),-10);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Series1->AddXY(Now(),Series1->YValues->Last()+random(5));
Chart1->Page = Chart1->NumPages();
}
//---------------------------------------------------------------------------

Posted: Mon Feb 05, 2007 4:25 pm
by Pep
Hi,

to accomplish that you will have to scale the axis manually, only for visible points. The best place to check them is in the OnAfterDraw event, there you can set the scales using the SetMinMax method checking the MinVisibleValue and MaxVisibleValue of the Series.