Articles in this section
Category / Section

How to redraw WPF Chart (SfChart) while dragging the series out of the range?

1 min read

You can redraw in the predefined range for WPF Chart (SfChart) by using DragEnd event, which is used to add the functionalities after dragging. In the DragEnd event, you can get the new position and axis value where the segment is dragged. You can change the secondary axis and values of the Minimum and Maximum properties based on the new value. 


         <chart:CategoryAxis x:Name="axis1" />
         <chart:NumericalAxis x:Name="sec_axis" Minimum="10" Maximum="350" RangePadding="Round" Interval="50" />
    <chart:LineSeries XBindingPath="Product" YBindingPath="Price" DragEnd="LineSeries_DragEnd" ItemsSource="{Binding Products}" EnableDragTooltip="True" EnableSegmentDragging="True" >


private void LineSeries_DragEnd(object sender, Syncfusion.UI.Xaml.Charts.ChartDragEndEventArgs e)
     sec_axis.Minimum = e.NewYValue;
   else if(e.NewYValue>sec_axis.Maximum)
     sec_axis.Maximum = e.NewYValue;

The below image represents Initial segment position and preview dragging segment position.

LIne series before dragging in WPF Chart

The below image represents Segment redrawn after dragging.

Line series after dragging in WPF Chart


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied