I'm binding the series of an SfChart as shown below:
<syncfusion:SfChart Grid.RowSpan="2" Series="{Binding Path=ChartSeries}">
I dynamically create line series' and add them to this ChartSeries, which works and the Lines display as intended:
private void CreateLineSeries(measurement m)
{
Application.Current.Dispatcher.Invoke(() =>
{
FastLineBitmapSeries newLine = new FastLineBitmapSeries();
newLine.ItemsSource = measurement.DataPoints;
newLine.XBindingPath = "TimeStamp";
newLine.YBindingPath = "Data";
newLine.IsSeriesVisible = false;
newLine.Label = measurement.Name + " (" + measurement.Units + ")";
Application.Current.Dispatcher.Invoke(() =>
{
ChartSeries.Add(newLine);
});
});
}
}
}
However, when I try to remove Elements from the ItemsSource after the Source gets too large, I get an ArgumentOutOfRangeException
if (DataPoints.Count > MaxDataPoints)
{
Application.Current.Dispatcher.Invoke(() => {
DataPoints.RemoveAt(0);
});
}
Any idea why this would be happening?
Thanks
