DateTime Problem with Bottom Axis Labels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
mueco
Newbie
Newbie
Posts: 10
Joined: Fri Oct 27, 2006 12:00 am

DateTime Problem with Bottom Axis Labels

Post by mueco » Thu Oct 04, 2007 3:58 pm

Hi there

I've seen alot of posts with DateTime Problems but i don't found a post who fits with my problem.

My DateTimes wich i add to the series:
04.10.2007 17:50
05.10.2007 18:51
07.10.2007 20:53
10.10.2007 23:56
15.10.2007 04:00

DateTimes wich are displayed in my bottom axis labels:
03.10.2007 12:00:00
04.10.2007 00:00:00
04.10.2007 12:00:00
05.10.2007 00:00:00
05.10.2007 12:00:00
06.10.2007 00:00:00
06.10.2007 12:00:00
07.10.2007 00:00:00
07.10.2007 12:00:00
08.10.2007 00:00:00
08.10.2007 12:00:00
09.10.2007 00:00:00
09.10.2007 12:00:00
10.10.2007 00:00:00
10.10.2007 12:00:00
...

Something is going wrong, but i don't have a clue what it is.
I'm working with TeeChart v2.0

Here my Code:

Code: Select all

this.WebChart1.Chart.Series[0].Clear();

        System.Drawing.Color c = System.Drawing.Color.FromArgb(200, 164, 195, 234);
        System.Drawing.Color c1 = System.Drawing.Color.FromArgb(200, 164, 195, 200);
        Steema.TeeChart.Axis bAxis = this.WebChart1.Chart.Axes.Bottom;
       
        this.WebChart1.Chart.Series[0].XValues.DateTime = true;
        bAxis.Labels.DateTimeFormat = "dd.MM.yy HH:mm:ss";
        bAxis.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneHour);
        bAxis.Labels.Angle = 90;
        
        this.WebChart1.Chart.Panel.MarginBottom = 10;
        DateTime dt = DateTime.Now;
        
        ListBox1.Items.Clear();
        for (int i = 0; i < 5; i++)
        {
            dt = dt.Add(new TimeSpan(i,i,i,i));
            this.WebChart1.Chart.Series[0].Add(dt, i, c);
            ListBox1.Items.Add(dt.ToString("dd.MM.yyyy HH:mm"));
        }

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

Post by Narcís » Fri Oct 05, 2007 7:06 am

Hi mueco,

This is because your date time values are irregular and bottom axis displays regular intervals. If you want to display such levels you can try one of those options:

1. Adding DateTime as labels in your points as well, for example: Add(DateTime, YValue, DateTime.ToString(), Color).

2. Use custom axis labels as shown in the All Features\Welcome !\Axes\Labels\Custom labels example at the features demo, available at TeeChart's program group.

Hope this helps!
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

mueco
Newbie
Newbie
Posts: 10
Joined: Fri Oct 27, 2006 12:00 am

Post by mueco » Sat Oct 06, 2007 10:24 pm

Hi Narcis

First of all, THX a lot for your help, but to be honest, im stuck on this.
In my eyes, its a very simple thing but i can't get a result for this.

I want to explain you what im trying to do:
I want two views for my chart
1. View: in Hours
2. View: in Days

Im selecting the data as i needed in the chart from the database
(as example for - in hours):
06.10.2007 08:00
06.10.2007 13:00
07.10.2007 15:00
...

Note: I set the angle to 90 Degrees, so there should be no overlapping problem. Sadly i have no webspace at the moment for some screenshots.

(as example for - in days)
Fr Sa Tu
29 30 03 ...

What im want to do is. I want all data without any spacing between and only the hours or days wich exists from my data (no null values etc).

The increment "OneHour" sadly fills my null or not existing hours with null values, without the Increment i have spaces between the missing ones.

For some reasons some labels are not drawn (empty), but i think the gap between the labels are enough to display.

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

Post by Narcís » Mon Oct 08, 2007 7:44 am

Hi mueco,

In that case you can try doing something as in the All Features\Welcome !\Chart styles\Financial\Candle (OHLC)\Axis Labels no Weekends example in the features demo, 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

mueco
Newbie
Newbie
Posts: 10
Joined: Fri Oct 27, 2006 12:00 am

Post by mueco » Mon Oct 08, 2007 12:46 pm

THX a lot

This sample was the answear to my questions.

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

Post by Narcís » Mon Oct 08, 2007 1:10 pm

Hi mueco,

You're welcome! I'm glad to hear that helped.
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

Post Reply