Page 1 of 1

DateTime increment on bottom axis

Posted: Fri Jun 15, 2007 10:04 am
by 9644663
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.

Posted: Fri Jun 15, 2007 10:22 am
by narcis
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.

Posted: Fri Jun 15, 2007 10:27 am
by 9644663
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.

Posted: Fri Jun 15, 2007 10:40 am
by narcis
Hi Vidar,

Could you please try using DateTimeSteps as shown here?

Thanks in advance.

Posted: Fri Jun 15, 2007 10:57 am
by 9644663
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

Posted: Fri Jun 15, 2007 1:46 pm
by narcis
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.

Posted: Fri Jun 15, 2007 1:53 pm
by 9644663
hi,

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

Regards.