Automatic scaling only points shown in chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Berntsen
Newbie
Newbie
Posts: 11
Joined: Wed Oct 05, 2005 4:00 am

Automatic scaling only points shown in chart

Post by Berntsen » Wed Jan 31, 2007 7:39 am

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

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 Jan 31, 2007 10:28 am

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.
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

Berntsen
Newbie
Newbie
Posts: 11
Joined: Wed Oct 05, 2005 4:00 am

Post by Berntsen » Wed Jan 31, 2007 12:38 pm

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();
}
//---------------------------------------------------------------------------

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Feb 05, 2007 4:25 pm

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.

Post Reply