show datetime on the x-axis
Posted: Tue Sep 29, 2015 7:31 am
Code: Select all
public class NumberAxis
{
public DateTime X { get; set; }
public int Y { get; set; }
public int Z { get; set; }
}
private void Form1_Load(object sender, EventArgs e)
{
List<NumberAxis> stemp = new List<NumberAxis>();
for (int t = 0; t < 20; t++)
{
DateTime dt = DateTime.Parse("2015-02-14 12:02:06");
NumberAxis ss = new NumberAxis() { X = dt.AddDays(t), Y = t, Z = t };
stemp.Add(ss);
}
tChart1.Axes.Bottom.Labels.ExactDateTime = true;
tChart1.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
tChart1.Axes.Bottom.Labels.Angle = 90;
points3D1.DataSource = stemp;
points3D1.XValues.DataMember = "X";
points3D1.XValues.DataMember = "Y";
points3D1.ZValues.DataMember = "Z";
}