Page 1 of 1

Date time axis

Posted: Tue Jan 11, 2005 5:10 pm
by 9080952
Hi,

I am trying to implement axes with date time labels, studied the tutorial, but for some reason, it does not work.

Here is my code:
DateTime[] dateTimes;
(...)
// populating series
line.XValues.DateTime = true;
tChart1.Series.Add(line);
for (int iTime=0;iTime<noTimes;iTime++)
{
xValues[iTime] = dateTimes[iTime];
yValues[iTime] = gsSeries[iPar,iLoc,iTime];
}
tChart1.Series[iLoc].Add(xValues,yValues);
tChart1.Series[iLoc].Title = gsLocations[iLoc];
tChart1.Series[iLoc].VertAxis=
Steema.TeeChart.Styles.VerticalAxis.Both;
tChart1.BackColor = Color.White;
// time axis at bottom
Steema.TeeChart.Axis bottom;
bottom = tChart1.Axes.Bottom;
bottom.Chart = tChart1.Chart;
bottom.Labels.DateTimeFormat = "yyyy-mm-dd hh:mm:ss";
bottom.Increment = (double)
Steema.TeeChart.DateTimeSteps.OneMinute;
bottom.AutomaticMinimum = true;
bottom.AutomaticMaximum = true;
bottom.Visible = true;

In this example the date time ranges from "1990-01-09 00:00:00" up to "1990-01-09 00:06:00" with a time step of 30 seconds.
However, at the bottom axis the first time label is "1990-00-09 12:00:00", while I expect 1990-01-09 00:00:00". Strange ...

At the other hand this time label is the only label I see, while I expect a label each minute (Steema.TeeChart.DateTimeSteps.OneMinute
) ??

The time series itself are properly displayed, but there is still a problem with displaying the time axis. Some help would be nice.

Thanks,
Antoon Koster

Posted: Fri Jan 14, 2005 4:48 pm
by Pep
Hi Antoon,

I think the problem is that the following line :
bottom.Labels.DateTimeFormat = "yyyy-mm-dd hh:mm:ss";
should be :
bottom.Labels.DateTimeFormat = "yyyy-MM-dd hh:mm:ss";

Posted: Mon Jan 17, 2005 11:44 am
by 9080952
Hi,

Strange, but the format "yyyy-MM-dd hh:mm:ss" displays the month in the date-time format correctly.
First I had "1900-00-09 12:00:00", now "1900-01-09 12:00:00"

But there is still another problem ...

Printing the xValues[iTime].toString() results in:
Date-time : 09/01/1900 00:00:00
Date-time : 09/01/1900 00:00:30
Date-time : 09/01/1900 00:01:00
Date-time : 09/01/1900 00:01:30
Date-time : 09/01/1900 00:02:00
Date-time : 09/01/1900 00:02:30
Date-time : 09/01/1900 00:03:00
Date-time : 09/01/1900 00:03:30
Date-time : 09/01/1900 00:04:00
Date-time : 09/01/1900 00:04:30
Date-time : 09/01/1900 00:05:00
Date-time : 09/01/1900 00:05:30

So the the firstdate-time label along the time-axis must be: 1990-01-09 00:00:00 , but it shows time 1990-01-09 12:00:00??



Regards,
Antoon Koster
Netherlands

Posted: Wed Jan 26, 2005 5:39 pm
by Pep
Hi Antoon,

how about using :
bottom.Labels.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
?