X Axis Showing dd-MM only

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
dave
Newbie
Newbie
Posts: 35
Joined: Fri Feb 24, 2006 12:00 am

X Axis Showing dd-MM only

Post by dave » Mon Jul 30, 2007 6:24 am

Hi,

I've got a chart which currently compares line series from different years, therefore the x-axis goes from 0 to 365. I would like it to have dd-MM format instead. How could I do this?

Thanks.

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Mon Jul 30, 2007 9:17 am

Hi Dave

You can do it as below line:

Code: Select all

tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd-MM";
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

dave
Newbie
Newbie
Posts: 35
Joined: Fri Feb 24, 2006 12:00 am

Post by dave » Mon Jul 30, 2007 11:38 pm

Hi Edu,

This will not work because, like I said earlier, my current x-axis values are integer from 0 to 365.

My series is filled by the following code:

Code: Select all

DateTime startYear = new DateTime(2007, 01, 01);
for (int i = 0; i<dRow.Length; i++)
{
DateTime currentDate = Convert.ToDateTime(dRow[i]["date"].ToString())
TimeSpan ts = currentDate.Subtract(startYear)
int daysDifference = ts.Days;

lineSeries.Add(daysDifference, Single.Parse(dRow[i]["values"].ToString()))
}
Instead of showing daysDifference on the x-axis, I would like to show a DateTime x-axis with a format of "dd-MM". How could I do it?

dave
Newbie
Newbie
Posts: 35
Joined: Fri Feb 24, 2006 12:00 am

Post by dave » Tue Jul 31, 2007 4:56 am

Hi Edu,

Pls ignore my question. I've managed to plot what I wanted by substituting the years with a common year (for example, 2000), then setting the x-axis format to "dd-MM".

Thanks.

Post Reply