示意图
设置X轴以时间为刻度
代码
//显示格式为时:分:秒
AzTimeChart.ChartAreas[0].AxisX.Minimum = DateTime.Now.AddSeconds(-90).ToOADate(); // 设置X轴最小值和偏移量(这里是当前时间-90秒)
AzTimeChart.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(10).ToOADate(); // 设置X轴最大值和偏移量(这里是当前时间+10秒)
AzTimeChart.ChartAreas[0].AxisX.Interval = 5; // 设置X轴间隔(这里是5秒一个刻度)
AzTimeChart.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Seconds; // 设置间隔类型为秒
AzTimeChart.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss"; // 设置X轴标签显示的时间格式
AzTimeChart.Series[0].SmartLabelStyle.Enabled = true; // 这里是让标签根据密度转换风格
AzTimeChart.Series[0].XValueType = ChartValueType.DateTime; // 坐标轴typ