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
1

Hi,

in a MVVM scenario, I bind the AnimatedVisibleRange to a property in the view model.

 <s:SciChartSurface SeriesSource="{Binding ChartSeries}">
   <s:SciChartSurface.XAxis>
     <s:NumericAxis AxisTitle="x" AnimatedVisibleRange="{Binding XVisibleRange, Mode=TwoWay}" AutoRange="Never" />
   </s:SciChartSurface.XAxis>
   <s:SciChartSurface.YAxis>
     <s:NumericAxis AxisTitle="y" AnimatedVisibleRange="{Binding YVisibleRange, Mode=TwoWay}" AutoRange="Never" />
   </s:SciChartSurface.YAxis>
   <s:SciChartSurface.ChartModifier>
     <s:ModifierGroup>
       <s:MouseWheelZoomModifier IsEnabled="True" XyDirection="XDirection"/>
     </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
 </s:SciChartSurface>

Setting the XVisibleRange property in the view model smoothly animates the view. However, when I zoom in the chart with the mouse wheel, the view model property receives no updates (so the XVisibleRange property in the view model always stays on the value initially set by the view model).

The same thing works when I bind he VisibleRange instead of the AnimatedVisibleRange, i.e. in that case I get an update of the view model property on every mouse wheel zoom.

Is this intendend, or a bug? Building a workaround would require additional bindings, which I would like to avoid.

Best regards,

Andree

  • You must to post comments
1
0

Hi Andree,

Thanks for your inquiry. Concerning your question, it isn’t a bug. You don’t receive any updates in the ViewModel because the AnimatedVisibleRange property is not used for interaction. In fact, it is never set internally, because it has been designed to be used on user’s side in MVVM scenarios.

It is quite easy to workaround, but I would suggest changing approach and binding the whole axis instance instead. Then you could subscribe to the VisibleRangeChanged event to receive notifications and set VisibleRange calling IAxis.AnimateVisibleRangeTo(..).
Actually, this is what AnimatedVisibleRange does in property callback.

Hope this helps!

Best regards,
Yuriy

  • Andrew
    To add to this, AnimatedVisibleRange is designed to allow a OneWay binding from ViewModel to Axis, allowing you to trigger animation to a visible range from a viewmodel.The VisibleRange property though allows TwoWay binding to a viewmodel.What Yuriy says is the best way, direct control over the axis can be achieved through the IAxis interface.
  • Andree Grosse
    Ok, thanks for the quick answer Yuriy & Andrew! Using AnimateVisibleRangeTo(...) was one of the workaround I tried, and I can understand that it is a design decision to not set the AnimatedVisibleRange internally.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.