DateTime zero axis label
DateTime zero axis label
BDS2007 C++ module, TChart 7.12
We cannot get the right axis to always show zero time (00:00:00). The zero label will initially be missing, then appear, then disappear as data is added. The zero tick mark is always visible, but the label is not.
The data includes a zero as the first point, and data is added increments of one seconds. We have played with all the settings below without success.
tripTimeSeries->YValues->DateTime = true;
Chart1->RightAxis->Automatic = false;
Chart1->RightAxis->AutomaticMaximum = true;
Chart1->RightAxis->AutomaticMinimum = false;
Chart1->RightAxis->Minimum = 0.0;
Chart1->RightAxis->DateTimeFormat = LongTimeFormat;
Chart1->RightAxis->ExactDateTime = true;
Chart1->RightAxis->LabelsOnAxis = true;
Chart1->RightAxis->Increment = DateTimeStep[dtOneSecond];
Very frustrated and need help
thanks
Kevin
We cannot get the right axis to always show zero time (00:00:00). The zero label will initially be missing, then appear, then disappear as data is added. The zero tick mark is always visible, but the label is not.
The data includes a zero as the first point, and data is added increments of one seconds. We have played with all the settings below without success.
tripTimeSeries->YValues->DateTime = true;
Chart1->RightAxis->Automatic = false;
Chart1->RightAxis->AutomaticMaximum = true;
Chart1->RightAxis->AutomaticMinimum = false;
Chart1->RightAxis->Minimum = 0.0;
Chart1->RightAxis->DateTimeFormat = LongTimeFormat;
Chart1->RightAxis->ExactDateTime = true;
Chart1->RightAxis->LabelsOnAxis = true;
Chart1->RightAxis->Increment = DateTimeStep[dtOneSecond];
Very frustrated and need help
thanks
Kevin
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Kevin,
It works fine for me here dropping a TChart in a form with a TLineSeries and this code:
Can you reproduce the issue using code above? If the problem persists, could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
It works fine for me here dropping a TChart in a form with a TLineSeries and this code:
Code: Select all
void __fastcall TForm1::FormCreate(TObject *Sender)
{
count=0;
Series1->XValues->DateTime = true;
Series1->YValues->DateTime = true;
Series1->VertAxis = aRightAxis;
Chart1->Axes->Right->DateTimeFormat = "hh:mm:ss";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Series1->AddXY(count, count);
count++;
}
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
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 |
Here is an example that fails. The failure occurs only on some values of the range. It works at 2000, fails at 2100, for example.
Chart1->RightAxis->Automatic = false;
Chart1->RightAxis->AutomaticMaximum = true;
Chart1->RightAxis->AutomaticMinimum = false;
Chart1->RightAxis->Minimum = 0.0;
Chart1->RightAxis->DateTimeFormat = LongTimeFormat;
Chart1->RightAxis->ExactDateTime = true;
Chart1->RightAxis->LabelsOnAxis = true;
Chart1->RightAxis->Increment = DateTimeStep[dtOneSecond];
fs1->XValues->Order = loNone;
fs1->YValues->Order = loNone;
fs1->YValues->DateTime = true;
fs1->Title = "Trip Time";
fs1->Clear();
fs1->ParentChart = Chart1;
fs1->HorizAxis = aBottomAxis;
fs1->VertAxis = aRightAxis;
fs1->SeriesColor = clBlue;
double sec_to_day = 1.0/86400.0;
double t;
for(int i=0;i< 2100;i++)
{
t = i;
fs1->AddXY(i, t*sec_to_day,"",clTeeColor);
}
Chart1->RightAxis->Automatic = false;
Chart1->RightAxis->AutomaticMaximum = true;
Chart1->RightAxis->AutomaticMinimum = false;
Chart1->RightAxis->Minimum = 0.0;
Chart1->RightAxis->DateTimeFormat = LongTimeFormat;
Chart1->RightAxis->ExactDateTime = true;
Chart1->RightAxis->LabelsOnAxis = true;
Chart1->RightAxis->Increment = DateTimeStep[dtOneSecond];
fs1->XValues->Order = loNone;
fs1->YValues->Order = loNone;
fs1->YValues->DateTime = true;
fs1->Title = "Trip Time";
fs1->Clear();
fs1->ParentChart = Chart1;
fs1->HorizAxis = aBottomAxis;
fs1->VertAxis = aRightAxis;
fs1->SeriesColor = clBlue;
double sec_to_day = 1.0/86400.0;
double t;
for(int i=0;i< 2100;i++)
{
t = i;
fs1->AddXY(i, t*sec_to_day,"",clTeeColor);
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello Kevin,
I'm not able to reproduce the issue here. This may even depend on the chart dimensions and if it's a 2D or 3D chart. Could you please give us this information? A simple example project we can run "as-is" to reproduce the problem here would be very helpful too.
Thanks in advance.
I'm not able to reproduce the issue here. This may even depend on the chart dimensions and if it's a 2D or 3D chart. Could you please give us this information? A simple example project we can run "as-is" to reproduce the problem here would be very helpful too.
Thanks in advance.
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 |
The code you see is the entire code for the test project, except for the TForm constructor, which has no code. The code executes via a pushbutton event. 3D is turned off. I will upload the whole project if you wish -- but there is no other code.
"fs1" is a FastLineSeries, and the only series in the chart. The chart and the lineseries have default properties, except those you see in the code.
The variation is primarily dependent on the maximum value of time, though the same code run on my home computer shows the error at 2150 seconds instead of 2100 -- so there may be some screen resolution variations.
In our application, the time scale progress from 0 to an arbitrary value during a simulation. As time progresses, the user sees the 00:00:00 appear and disappear as the maximum time value increases. At the end of the simulation, the 00:00:00 may or not be there, depending on the maximum time value reached.
Using our test code, if you set some delay into the point plotting to see intermediate updates, you see the zero point disappear, then reappear.
double sec_to_day = 1.0/86400.0;
double t;
for(int i=0;i< 2100;i++)
{
t = i;
fs1->AddXY(i, TDateTime(t*sec_to_day),"",clTeeColor);
// set some delay to allow viewing of intermediate activity
for(long y=0;y<1000000;y++)
;
Chart1->Repaint();
}
"fs1" is a FastLineSeries, and the only series in the chart. The chart and the lineseries have default properties, except those you see in the code.
The variation is primarily dependent on the maximum value of time, though the same code run on my home computer shows the error at 2150 seconds instead of 2100 -- so there may be some screen resolution variations.
In our application, the time scale progress from 0 to an arbitrary value during a simulation. As time progresses, the user sees the 00:00:00 appear and disappear as the maximum time value increases. At the end of the simulation, the 00:00:00 may or not be there, depending on the maximum time value reached.
Using our test code, if you set some delay into the point plotting to see intermediate updates, you see the zero point disappear, then reappear.
double sec_to_day = 1.0/86400.0;
double t;
for(int i=0;i< 2100;i++)
{
t = i;
fs1->AddXY(i, TDateTime(t*sec_to_day),"",clTeeColor);
// set some delay to allow viewing of intermediate activity
for(long y=0;y<1000000;y++)
;
Chart1->Repaint();
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello Kevin,
Yes, we are investigating the issue and will get back to you ASAP.
Yes, we are investigating the issue and will get back to you ASAP.
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 Kevin,
a solution for this problem would be to do the following :
This way the minimum right axis label will be always displayed.
a solution for this problem would be to do the following :
Code: Select all
void __fastcall TForm2::Button1Click(TObject *Sender)
{
double sec_to_day = 1.0/86400.0;
double t;
cancel = false;
ls1->Clear();
for(int i=0;i< 2150;i++)
{
t = i;
ls1->AddXY(i, t*sec_to_day,"",clTeeColor);
Application->ProcessMessages();
Chart1->Canvas->Brush->Color=Chart1->Color;
Chart1->Axes->Right->DrawAxisLabel(Chart1->Axes->Right->PosLabels,
Chart1->Axes->Right->CalcYPosValue(0.0)-1, 0,
"0:00:00");
if(cancel)
break;
}
}
Pep Jorge
http://support.steema.com
http://support.steema.com