DateTime increment on bottom axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Vidar
Newbie
Newbie
Posts: 9
Joined: Tue Mar 27, 2007 12:00 am

DateTime increment on bottom axis

Post by Vidar » Fri Jun 15, 2007 10:04 am

hi,

I'm having a problem with the date time increment for a webChart on the bottom axis. I'm calulating values for each week this year and I need the chart to show one week increment on the bottom axis which spans the first week of the year (1.1.2007) all the way to the current week (15.6.2007) btw. I'm using (dd.mm.yyyy).

Currently I'm inserting datetime values and the graph changes the increment (increasing it) as time goes by. When I implemented this solution in march it worked just as I wanted (one value for each week increment and I have bottomAxis.increment = 7) now there doesn't seem to be any order to the increment.

Any help would be great.

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 Jun 15, 2007 10:22 am

Hi Vidar,

You can try setting axis increment to a DateTimeStep being one week. You'll find more information on how to do that in Tutorial 4 - Axis Control. Tutorials can be found on 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

Vidar
Newbie
Newbie
Posts: 9
Joined: Tue Mar 27, 2007 12:00 am

Post by Vidar » Fri Jun 15, 2007 10:27 am

I tried to do this

Code: Select all

WebChart1.Chart.Axes.Bottom.Increment = Steema.TeeChart.DateTimeSteps.OneWeek;
But since .Increment accepts only double then I tried

Code: Select all

WebChart1.Chart.Axes.Bottom.Increment = (double)Steema.TeeChart.DateTimeSteps.OneWeek;
but that doesn't help.

Regards.

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 Jun 15, 2007 10:40 am

Hi Vidar,

Could you please try using DateTimeSteps as shown here?

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

Vidar
Newbie
Newbie
Posts: 9
Joined: Tue Mar 27, 2007 12:00 am

Post by Vidar » Fri Jun 15, 2007 10:57 am

hi,

Now we are getting somewhere,

Code: Select all

WebChart1.Chart.Axes.Bottom.SetMinMax(DateTime.Parse("01.01.2007"), DateTime.Parse(day));
WebChart1.Chart.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneWeek);
This is the code I'm using. I set the min to 01.01.2007 and max to the date today.

what i get as labels on the grid is the increment (1.1.2007, 15.1.2007, 1.2.2007,15.2.2007 ..... 1.6.2007, 15.6.2007) which is not the correct increment.

Regards

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 Jun 15, 2007 1:46 pm

Hi Vidar,

This is most likely because labels in a week interval don't fit in your axes without overlapping and TeeChart automatically avoids this overlapping. You can try setting labels angle to 90 degrees:

Code: Select all

WebChart1.Chart.Axes.Bottom.Labels.Angle=90;
That way you'll know if it's a space problem.
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

Vidar
Newbie
Newbie
Posts: 9
Joined: Tue Mar 27, 2007 12:00 am

Post by Vidar » Fri Jun 15, 2007 1:53 pm

hi,

This was the correct solution. Thank you very much for the quick response.

Regards.

Post Reply