Code: Select all
/// <summary>
/// XYZ轴类
/// </summary>
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)
{
points3D1 = new Points3D(tChart1.Chart);
this.tChart1.Header.Text = "端口XXXX";
this.tChart1.Axes.Left.Title.Caption = "YYYY";
this.tChart1.Axes.Bottom.Title.Caption = "XXXX";
this.tChart1.Axes.Depth.Title.Caption = "ZZZZ";
this.tChart1.Axes.Depth.Visible = true;
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.Style = AxisLabelStyle.PointValue;
tChart1.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
tChart1.Axes.Bottom.Labels.Angle = 90;
tChart1.Series[0].Marks.Visible = true;
tChart1.Series[0].Marks.Style = MarksStyles.XY;
this.points3D1.Marks.MultiLine = true;
this.tChart1.Series[0].GetSeriesMark += new Series.GetSeriesMarkEventHandler(Form1_GetSeriesMark);
points3D1.DataSource = stemp;
points3D1.XValues.DataMember = "X";
points3D1.YValues.DataMember = "Y";
points3D1.ZValues.DataMember = "Z";
}
void Form1_GetSeriesMark(Series series, GetSeriesMarkEventArgs e)
{
e.MarkText +=Environment.NewLine+ series.ValuesLists[2][e.ValueIndex].ToString(series.ValueFormat);
}