WPF Chart DateTime Format problem

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MGV
Newbie
Newbie
Posts: 9
Joined: Wed May 23, 2007 12:00 am

WPF Chart DateTime Format problem

Post by MGV » Fri Oct 17, 2008 7:52 am

Hello
in this example datetime is not shown correctly( we do not see 24 hour format )



tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yy hh:mm";

tChart1.Axes.Bottom.Labels.Angle = 90;

line1.XValues.DateTime = true;



DateTime dt = DateTime.Today;

for (int i = 0; i < 48; i++)

{

line1.Add(dt, i);

dt = dt.AddMinutes(30);

}

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 17, 2008 9:36 am

Hi MGV,

To achieve what you request you need to set DateTimeFormat as described in Custom Date and Time Format Strings, for example:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yy HH:mm";
			tChart1.Axes.Bottom.Labels.Angle = 90;
			line1.XValues.DateTime = true;

			DateTime dt = DateTime.Today;

			for (int i = 0; i < 48; i++)
			{
				line1.Add(dt, i);
				dt = dt.AddMinutes(30);
			}
		}
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