SfChart Scrolling
hello,I have currently set AutoScrollingDelta to 26, but my horizontal axis has 40. When I drag the scroll bar to view horizontal coordinates from 14 to 40, each time I receive new data to update the chart, the scroll bar automatically scrolls back to 1. What I want is to maintain the position I set by dragging the scroll bar, even if the data keeps updating.
<syncfusion:SfChart.PrimaryAxis>
<syncfusion:CategoryAxis
behaviors:ScrollViewerDragBehavior.EnableDrag="True"
AutoScrollingDelta="26"
AutoScrollingMode="Start"
DeferredScrolling="False"
EnableScrollBar="True"
EnableScrollBarResizing="True"
Interval="1"
LabelBorderBrush="#04bee0"
LabelBorderWidth="0.5"
LabelTemplate="{StaticResource labelTemplate}"
ShowLabelBorder="True">
<syncfusion:CategoryAxis.AxisLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#04bee0" />
<Setter Property="StrokeThickness" Value="2" />
</Style>
</syncfusion:CategoryAxis.AxisLineStyle>
</syncfusion:CategoryAxis>
</syncfusion:SfChart.PrimaryAxis>
Hi Tom,
Thank you for contacting us regarding the scrolling behavior in SfChart.
When using a WPF SfChart with AutoScrollingDelta = 26 and your horizontal axis contains around 40 data points, you may observe that the scrollbar automatically jumps back to the start whenever new data is added.
This expected behavior occurs because AutoScrollingDelta is designed to keep the most recent data visible at all times. Since AutoScrollingMode is set to Start, the chart resets the visible range whenever new points are added, resulting in the scrollbar snapping back to the beginning.
To maintain the current scrollbar position while data continues to update, we recommend handling the ActualRangeChanged event and dynamically setting AutoScrollingDelta to double.NaN during scrolling.
This prevents the axis from resetting its position while still allowing the chart to update dynamically.
[XAML]
<syncfusion:SfChart.PrimaryAxis> <syncfusion:CategoryAxis x:Name="primaryAxis" AutoScrollingDelta="26" AutoScrollingMode="Start" ActualRangeChanged="primaryAxis_ActualRangeChanged" ------------------------------------- ------------------------------------- </syncfusion:CategoryAxis> </syncfusion:SfChart.PrimaryAxis> |
[C#]
private void primaryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) { if( e.IsScrolling && !(primaryAxis.AutoScrollingDelta == double.NaN)) { primaryAxis.AutoScrollingDelta = double.NaN; } } |
Using this approach ensures that when new data arrives, the scroll position remains exactly where the user left it. We have tested this scenario on our side, and the scrollbar stays fixed while the chart continues to update the axis range according to data adding.
We can hold and resume the series updates using the SuspendSeriesNotification and ResumeSeriesNotification methods, which allow the axis range updates to be paused. We can add this logic in the ActualRangeChanged event to resume only when scrolling is enabled, but it may take additional time to load the data that was resumed.
Reference:
ActualRangeChanged event in WPF Charts control | Syncfusion
AutoScrollingDelta Behavior in WPF Charts control | Syncfusion
Performance in WPF Charts control | Syncfusion
If you have any further questions or need additional assistance, please feel free to contact us.
Regards,
Vallarasu R
- 1 Reply
- 2 Participants
-
TO Tom
- Mar 24, 2026 01:05 AM UTC
- Mar 24, 2026 01:20 PM UTC