在chart中的事件添加AxisViewChanged事件。
代码如下
private void chart1_AxisViewChanged(object sender, ViewEventArgs e)
{
int xmax = (int)chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;
int xmin = (int)chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;
int time = (xmax - xmin) ;
label1.Text = time.ToString()+"us";
label2.Text = xmax.ToString() + "us";
label3.Text = xmin.ToString() + "us";
}
xmax:x轴最大值
xmin:x轴最小值