DateTime zero axis label

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
kmanuele
Newbie
Newbie
Posts: 24
Joined: Wed Jan 12, 2005 5:00 am

DateTime zero axis label

Post by kmanuele » Tue Jan 29, 2008 8:11 pm

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

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 30, 2008 9:18 am

Hi Kevin,

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++;
}
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.
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

kmanuele
Newbie
Newbie
Posts: 24
Joined: Wed Jan 12, 2005 5:00 am

Post by kmanuele » Mon Feb 04, 2008 8:28 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 05, 2008 10:51 am

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

kmanuele
Newbie
Newbie
Posts: 24
Joined: Wed Jan 12, 2005 5:00 am

Post by kmanuele » Tue Feb 05, 2008 6:02 pm

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

kmanuele
Newbie
Newbie
Posts: 24
Joined: Wed Jan 12, 2005 5:00 am

Post by kmanuele » Sat Feb 09, 2008 2:53 am

I have uploaded the entire project to the Steema newgroup.

Hope you can reproduce this, and offer resolution soon.

Kevin

kmanuele
Newbie
Newbie
Posts: 24
Joined: Wed Jan 12, 2005 5:00 am

Post by kmanuele » Thu Feb 14, 2008 1:48 am

Is there any activity on this? Have you been able to reproduce it?

Note that the same problem occurs on two different machines, so it is not a quirk of one Steema or RAD2007 installation.

Kevin

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 14, 2008 11:38 am

Hello Kevin,

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
Image Image Image Image Image Image
Instructions - How to post in this forum

kmanuele
Newbie
Newbie
Posts: 24
Joined: Wed Jan 12, 2005 5:00 am

Post by kmanuele » Thu Mar 13, 2008 3:05 pm

How are you progressing on this?

Is there a temporary solution we can implement on our side?

thanks

Kevin

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

Post by Pep » Tue Mar 18, 2008 12:42 pm

Hi Kevin,

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;
	}
}
This way the minimum right axis label will be always displayed.

Post Reply