Page 1 of 1

WPF Chart DateTime Format problem

Posted: Fri Oct 17, 2008 7:52 am
by 14045274
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);

}

Posted: Fri Oct 17, 2008 9:36 am
by narcis
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);
			}
		}