怎么可以添加两条竖着的CursorX?怎么滚动鼠标滑轮同步缩放X轴的刻度?最小刻度10毫秒。
添加两条竖着的CursorX
chart1.CursorX.IsUserEnabled = true;
chart1.CursorX.IsUserSelectionEnabled = true;
chart1.CursorX.Interval = 0;
滚动鼠标滑轮同步缩放X轴的刻度
private void chart1_MouseWheel(object sender, MouseEventArgs e)
{
// 获取当前 X 轴的最小值和最大值
double xMin = chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;
double xMax = chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;
double xRange = xMax - xMin;
// 根据滚轮滚动方向来缩放
if (e.Delta > 0)
{
// 放大
chart1.ChartAreas[0].AxisX.ScaleView.Zoom(xMin + xRange / 10, xMax - xRange / 10);
}
else
{
// 缩小
chart1.ChartAreas[0].AxisX.ScaleView.Zoom(xMin - xRange / 10, xMax + xRange / 10);
}
}