Current filter:
                                You should refresh the page.

                                You are using an older version of the DevExpress Support Center.

                                  • [DevExpress Support Team: CLONED FROM T602252: Synchronize zooming and scrolling of multiple charts]
                                    One more thing. While zooming does work, scrolling does not. When I read the NewXRange from the XYDiagram2DScrollEventArgs MinValue always shrinks and MaxValue always increases, thus effectively zooming out, instead of moving left and right. Which values do I actually have to use when scrolling?

                                Show all comments
                                • Alex (DevExpress Support) 02.22.2018

                                  Hi Patrick,

                                  My attempts to reproduce a similar issue in a newly created sample project were not successful. Please test the attached example on your side and feel free to modify the source code to illustrate the issue. We will be happy to help you.

                                • Patrick Kunert 02.22.2018

                                  When attempting to gather the newXRange from the code behind, it does work as expected. Only when I call a command via EventToCommand it does return the incorrect range values.

                                  <dxmvvm:Interaction.Behaviors>
                                      <dxmvvm:EventToCommand EventName="Scroll" Command="{Binding InitializeScrollCommand}" PassEventArgsToCommand="True"/>
                                  </dxmvvm:Interaction.Behaviors>

                                • Patrick Kunert 02.22.2018

                                  public void InitializeScrollSynchronization(XYDiagram2DScrollEventArgs eventArgs)
                                  {
                                      this.EventAggregator.GetEvent<LineChartSynchronizationEvent>().Publish(new LineChartSynchronizationEventArgs(this.Id, eventArgs.NewXRange, eventArgs.NewYRange));
                                  }

                                  In this case, eventArgs.NewXRange already contains the incorrect min and max values.

                                • Alex (DevExpress Support) 02.23.2018

                                  Patrick,

                                  Please check whether it is possible to modify the attached sample project source code that uses the EventToCommand behavior to synchronize the axis range of different charts. We will check for a suitable solution for you.

                                • Patrick Kunert 02.23.2018

                                  Hm ... we are actually using prism for our MVVM pattern, therefore we have this view model:

                                  [C#]
                                  public class LineChartViewModel : BaseChartViewModel ... private IEventAggregator EventAggregator { get; } public ICommand InitializeScrollCommand { get; } private double _visualRangeXMinBorder; public double VisualRangeXMinBorder { get => this._visualRangeXMinBorder; set { this._visualRangeXMinBorder = value; RaisePropertyChanged(); } } private double _visualRangeXMaxBorder; public double VisualRangeXMaxBorder { get => this._visualRangeXMaxBorder; set { this._visualRangeXMaxBorder = value; RaisePropertyChanged(); } } public LineChartViewModel(IEventAggregator eventAggregator, ...) { ... this.EventAggregator = eventAggregator; this.InitializeScrollCommand = new DelegateCommand<XYDiagram2DScrollEventArgs>(InitializeScrollSynchronization); this.EventAggregator.GetEvent<LineChartSynchronizationEvent>().Subscribe(SynchronizeVisualRange, true); } ... public void InitializeScrollSynchronization(XYDiagram2DScrollEventArgs eventArgs) { this.EventAggregator.GetEvent<LineChartSynchronizationEvent>().Publish(new LineChartSynchronizationEventArgs(this.Id, eventArgs.NewXRange, eventArgs.NewYRange)); } private void SynchronizeVisualRange(LineChartSynchronizationEventArgs eventArgs) { this.VisualRangeXMinBorder = (double)eventArgs.VisualXRange.MinValue; this.VisualRangeXMaxBorder = (double)eventArgs.VisualXRange.MaxValue; this.VisualRangeYMinBorder = (double)eventArgs.VisualYRange.MinValue; this.VisualRangeYMaxBorder = (double)eventArgs.VisualYRange.MaxValue; } }

                                  So far we never had any trouble with prism's MVVM and the charts, so I'm unsure whether the interaction between the two causes the trouble.

                                • Alex (DevExpress Support) 02.23.2018

                                  Patrick,

                                  Please check if it is possible to modify the sample project source code (see above) to illustrate the issue (if necessary, you can mark this ticket as private). We will examine this behavior in greater detail and will check for a suitable solution.

                                • Patrick Kunert 03.20.2018

                                  I've created a sample project, which demonstrates the problem. I've noticed that, upon removing the range bindings, the scrolling works.

                                1 Solution

                                Creation Date Importance Sort by

                                Thank you for your sample project. I have replicated the problem on my side. It is not connected with the event to command functionality. The commands are raised correctly and receive correct arguments. The problem appears, because the arguments return the actual chart range, but when you set the Min and Max values using binding, the VisualRange automatically adds side margins to these values. To resolve the issue it is enough to set margins to 0 and disable automatic margins calculation.

                                [C#]
                                <dxc:AxisX2D.VisualRange> <dxc:Range MinValue="{Binding VisualRangeXMinBorder, Mode=OneWay}" MaxValue="{Binding VisualRangeXMaxBorder, Mode=OneWay}" AutoSideMargins="False" SideMarginsValue="0" /> </dxc:AxisX2D.VisualRange>
                                • Patrick Kunert 05.16.2018

                                  This has resolved the issue. Thanks.