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
Automatic scaling only points shown in chart
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
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();
}
//---------------------------------------------------------------------------
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();
}
//---------------------------------------------------------------------------
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.
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.
Pep Jorge
http://support.steema.com
http://support.steema.com