如何在组件一 C1Chart 中启用缩放

How to enable zooming in Component One C1Chart

我正在使用 c1 图表(组件一)绘图,我想启用缩放功能。我认为我需要鼠标滚轮事件,但我对这个话题不是很了解。情节在里面滚动查看器所以我必须小心。

我已经将此添加到 xaml。

    <c1:C1Chart.Actions>
        <c1:TranslateAction Modifiers="Shift" />
        <c1:ScaleAction Modifiers="Control" />
    </c1:C1Chart.Actions>

在xaml.cs中:

chart.ActionEnter += new EventHandler(Actions_Enter);
chart.ActionLeave += new EventHandler(Actions_Leave);

        private void Actions_Leave(object sender, EventArgs e)
    {
        chart.Cursor = Cursors.Arrow;
    }

    private void Actions_Enter(object sender, EventArgs e)
    {
        if (sender is ScaleAction)
            chart.Cursor = Cursors.SizeNS;
        else if (sender is TranslateAction)
            chart.Cursor = Cursors.SizeAll;
        else
            chart.Cursor = Cursors.Hand;
    }