SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

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.