如何通过添加ZoomIn和ZoomOut按钮
来控制Windows窗体图中的放大和缩小chart1.ChartAreas["draw"].AxisY.ScaleView.ZoomReset();
答案 0 :(得分:3)
放大按钮:
Axis ax = chart1.ChartAreas[0].AxisX;
ax.ScaleView.Size = double.IsNaN(ax.ScaleView.Size)?
(ax.Maximum - ax.Minimum) / 2 : ax.ScaleView.Size /= 2;
缩小:
Axis ax = chart1.ChartAreas[0].AxisX;
ax.ScaleView.Size = double.IsNaN(ax.ScaleView.Size)?
ax.Maximum : ax.ScaleView.Size *= 2;
if (ax.ScaleView.Size > ax.Maximum - ax.Minimum)
{
ax.ScaleView.Size = ax.Maximum;
ax.ScaleView.Position = 0;
}