Search code examples
c#componentone

How to enable zooming in Component One C1Chart


I am using c1 chart (Component One) to plot and I want to enable zooming feature. I think that I need mouse wheel event but I am not very advanced with that topic. The plot is inside to scroll viewer so I have to be becareful.


Solution

  • I already done adding this to xaml.

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

    In 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;
        }