Pre loader

ZoomExtents on SciChartGroup Child Charts

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


How do you enumerate child charts on a chart group?

My purpose is to try to call ZoomExtents() for each chart in a group after I an event is triggered from the ViewModel which reflects on code-behind of the Window.


  • You must to post comments

Hi Jayson,

You can’t enumerate the charts easily, as they are templated. If you really need to do this I would suggest looking at this article on ItemsControl.GetContainerFromItem.

However, sounds like you just want to zoom to extents on the child charts, am I right?

If so, we’ve literally just added the ability to Zoom Extents in our own Create Multi Pane Stock Charts example in v3.1, as we omitted this feature in v3.0. The code we’ve added to do this is below:

I’ve omitted irrelevant parts of the code.

1. The SciStockChart in the SciChartGroup ItemTemplate binds to a ViewportManager

<!-- Databinds a SciChartGroup to a list of ChartPaneViewModels -->
<!-- Child chart panes are generated using the ItemTemplate below -->
<s:SciChartGroup ... >
            <!-- Databinds each child SciStockChart ... -->
            <s:SciStockChart  ...  
                              ViewportManager="{Binding ParentViewModel.ViewportManager}"
                              SeriesSource="{Binding ChartSeriesViewModels}">

2. The ParentViewModel (shared by all charts) contains a ViewportManager instance

private IViewportManager _viewportManager;_viewportManager = new DefaultViewportManager();

public IViewportManager ViewportManager { get { return _viewportManager; } }

3. The ZoomExtents operation can now be performed via the ViewportManager

// Inside your ViewModel which hosts the ViewportManager
private void ZoomExtents()

That’s it! You can then control the viewport, zoom to extents etc… directly from your ViewModel

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.