2X faster development
The ultimate UWP UI toolkit to boost your development speed.
Description: The chart series can be dragged out of the boundary range, i.e., the Minimum and Maximum values that are not defined for the axis. This article describes how to drag the series with explicit minimum and maximum values. Solution The chart can be redrawn in the predefined range by using the 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. Based on the new value, you can change the secondary axis and values of the Minimum and Maximum properties. XAML <chart:SfChart> <chart:SfChart.PrimaryAxis> <chart:CategoryAxis x:Name="axis1" /> </chart:SfChart.PrimaryAxis> <chart:SfChart.SecondaryAxis> <chart:NumericalAxis x:Name="sec_axis" Minimum="10" Maximum="350" RangePadding="Round" Interval="50" /> </chart:SfChart.SecondaryAxis> <chart:LineSeries XBindingPath="Product" YBindingPath="Price" DragEnd="LineSeries_DragEnd" ItemsSource="{Binding Products}" EnableDragTooltip="True" EnableSegmentDragging="True" > </chart:LineSeries> </chart:SfChart> C# private void LineSeries_DragEnd(object sender, Syncfusion.UI.Xaml.Charts.ChartDragEndEventArgs e) { if(e.NewYValue<sec_axis.Minimum) { sec_axis.Minimum = e.NewYValue; } else if(e.NewYValue>sec_axis.Maximum) { sec_axis.Maximum = e.NewYValue; } } OutputFigure 1: Initial segment position and preview dragging segment position. Figure 2: Segment redrawn after dragging. |
2X faster development
The ultimate UWP UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.