SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & 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

what’s the way to bind the overview control to a chart in code?

I’m looking to add an overview control to a generic xaml chart, but only enable/bind the control when the I set the grid row visible.

I also plan to abstract the overview control into its own, freestanding control in order to bind it to the currently selected chart in a mult-chart window.

thanks in advance.

  • You must to post comments
-1
0

Hi there,

If you see our Overview Control Example you will see we use a Xaml binding to set the parent SciChartSurface:

        <sciChart:SciChartOverview Grid.Row="1" ParentSurface="{Binding ElementName=sciChart}" SelectedRange="{Binding ElementName=sciChart, Path=XAxis.VisibleRange, Mode=TwoWay}" sciChart:ThemeManager.Theme="Oscilloscope">            
        </sciChart:SciChartOverview>

The same thing can be achieved in code, simply set

var overview = new SciChartOverview();
overview.ParentSurface = sciChartSurface;
ThemeManager.SetTheme(overview, "Oscilloscope");

You will also need to set the binding from SelectedRange of OverviewControl to XAxis.VisibleRange of the SciChartSurface in code. Please see this MSDN article for guidance on setting bindings in code. The code should look something like this (I’ve not tested it)

  Binding myBinding = new Binding("XAxis.VisibleRange");
  myBinding.Source = sciChartSurface;
  overview.SetBinding(SciChartOverview.SelectedRange, myBinding);

Best regards,
Andrew

  • riverTrader
    Thanks! It is actually easier than your post. Apparently behind the scenes you do the same binding work for the range that you do for parent surface. simply: overviewChart.ParentSurface = sciChartSurface; overviewChart.SelectedRange = XVisibleRange; where overviewChart is the named overview element in the xaml view and XVisibleRange and sciChartsurface are the appropriate properties/objects in the viewModel
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.