Pre loader

How to best reset a SciChartGroup ?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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

  • You must to post comments
1
0

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:

  1. 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
  2. If you have set a ChartModifier, you must clear any MouseEventGroups applied
  3. If you have set SciChartGroup.VerticalChartGroup, you must clear this attached property
  4. If you have set any bindings between XAxis.VisibleRanges, these should be cleared with BindingOperations.ClearBinding
  5. 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?

  • bbmat
    @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 to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies