我正在使用以下代码来选择和缩放我的图表部分:
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
chart1.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;
chart1.ChartAreas[0].CursorY.IsUserEnabled = true;
chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
chart1.ChartAreas[0].AxisY.ScrollBar.IsPositionedInside = true;
它适用于具有整数类型的 x 和 y 轴的图表。
但是当我将系列值类型设置为 时series1.XValueType = ChartValueType.Time;
,我将无法放大 x 轴。
当我将两个轴值类型设置为自动并使用例如添加点时,chart1.Series[0].Points.AddXY(DateTime.Now.ToLongTimeString(), rand.Next(10, 20));
缩放就起作用了。
我怎样才能让我的 x 轴成为时间并且仍然能够缩放?