If my Xamldatachart contains 5 scatter series, is it possible to remove/clear a specific series once the code is re-run?
Chart.Series.Clear() will remove all the series. I would like to remove a specific series!
There are a few things you can do here to remove a specific series. If you know your series, or the index of it, I would recommend using the Remove or RemoveAt methods of the XamDataChart.Series collection, like so:
Alternatively, if at some point you are looking to show the same series again, perhaps you would consider keeping it in the chart, and just setting the Visibility property of the series to collapsed, as this would make the series disappear, like so:
Chart.Series.Visibility = Visibility.Collapsed;
Please let me know if you have any other questions or concerns on this matter.
Dear Andrew / Infragistics Tech Support
I have tried this approach to set Visibility.Collapsed for Series that are not selected from a group of Series. I add all the Series to XamDataChart.Series, then set Visibility.Collapsed based on whether they should be visible or not. I then simply change the Visibility property to show or hide Series.
I am finding that as I make Visible, there is a lot of memory that gets allocated and that never gets de-allocated. All I am doing is changing this Visibility property.
I make all my series Visibility.Visible, memory is allocated. I then set Visibility.Collapsed for all Series, memory remains the same, I then make all Series Visibility.Visible and more memory gets allocated.... I can repeat this until my application crashes.
I have 50 Series with 100 Data Points each in a ScatterLine plot.
Is there a way to address this issue?
If you aren't already using 2018 Volume 1 I would recommend that you test your application with 2018 Volume 1 to see if the leak has already been resolved as we have fixed a few leaks in the past year. If the leak does persist with 2018 Volume 1, please provide us with a sample that demonstrates the leak that we can use to look into what is happening.
I also recommend creating a new thread as the memory leak isn't directly related to the previous question.