Hello,
I wonder what the most efficient way is to completely reset (clean up) a SciChartGroup? I add all kinds of panes, add data series, add renderable series on different panes. Now, with a single call I like to reset the SciChartSurface to its original state (empty). I want to have all panes removed, as well as references the sciChartGroup may hold to panes, and references the panes hold to different renderable series and data series. I tried to clear ChartPaneViewModels, an observable collection that holds objects of type BaseChartPaneViewModel (which in turn implements IChildPane and ViewModelBase) but that did not have any effect. My SciChartGroup binds via ItemsSource to ChartPaneViewModels
What is your recommendation how to best reset the whole sciChartGroup?
Thanks,
Matt
- bbmat asked 9 years ago
- last edited 9 years ago
- You must login to post comments
Hi Matt,
The answer to this question is – it totally depends on what you did to the SciChartSurface in the first place!
Some pointers for you:
- If you have set an Axis and a VisibleRange, then you must null the VisibleRange, or set a new axis so that AutoRange.Once works again
- If you have set a ChartModifier, you must clear any MouseEventGroups applied
- If you have set SciChartGroup.VerticalChartGroup, you must clear this attached property
- If you have set any bindings between XAxis.VisibleRanges, these should be cleared with BindingOperations.ClearBinding
- If you have set any RenderableSeries, these should be removed
That should be it. Another way is to simply clear the RenderableSeries collection, set new X, YAxis and set a new ChartModifier instance. That way everything is new.
Does this help?
- Andrew Burnett-Thompson answered 9 years ago
-
@Andrew, thanks for the pointer. I think I forgot to edit the question title (my bad, will edit it), I actually meant to reset the entire SciChartGroup. Am I correct in the assumption that as long as I remove all ChartPaneViewModels to make available for GC and as long as I do not have hooks to events that hold reference that memory should be released that was taken up by data series and renderable series that are members of ChartPaneViewModels (via IChartSeriesViewModel)? I have not reached the stage of testing everything but at first sight references were still held up somewhere and resources not released...
- You must login to post comments
Please login first to submit.