This is a migrated thread and some comments may be shown as answers.

RadCartesianChart synchronize scrolling

2 Answers 211 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Alberto
Top achievements
Rank 1
Alberto asked on 31 Jul 2015, 10:18 AM

Hi,

I have a view with ​two different RadCartesianChart controls, with one scrollbar (on X-axis) for each chart. (see attached image)

I would like to synchronize the scrolling ​between the ​2 charts: for example when I scroll chart​​1, I would also like that in the same time also chart​0 ​is automatically scrolled. ​The two charts have the same settings and values for X axis.

I'm using a solution like the following:

private void SynchronizeChartsPan(object sender, Telerik.Windows.Controls.ChartView.ChartPanOffsetChangedEventArgs e)
{
Chart0.DetailsChart.PanOffsetChanged -= SynchronizeAnalyticDetailsChartsPan;
Chart1.DetailsChart.PanOffsetChanged -= SynchronizeAnalyticDetailsChartsPan;

if (sender != Chart0.DetailsChart) Chart0.DetailsChart.PanOffset = new Point(e.NewPanOffset.X, 0);
if (sender != Chart1.DetailsChart) Chart1.DetailsChart.PanOffset = new Point(e.NewPanOffset.X, 0);


Chart0.DetailsChart.PanOffsetChanged += SynchronizeAnalyticDetailsChartsPan;
Chart1.DetailsChart.PanOffsetChanged += SynchronizeAnalyticDetailsChartsPan;
}

 

The problem with this solution is that the synchronize scrolling does not bring all of the charts at the end at the same time: when I reach the end for chart1, I'm not at the end in the other chart. This seems to be related to a different "PlotAreaClip" in the ​two charts:  Y-Axis have different values and different sizes and this impact on the "PlotAreaClip" size.

What I would expect is that, since I have the same X-Axis in all the charts, when I scroll to the end on X-axis of chart1 I should reach the end also in other chart (regardless of Y-Axis)

How could I get this behaviour?

 Thanks and regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Anna
Telerik team
answered on 04 Aug 2015, 07:17 AM
Hello Alberto,

Thank you for the detailed explanation and the screenshot.

You are absolutely correct about the behavior you've observed and its cause. The plot area is different in the two charts and regardless of them having the same settings for the X-axis, the resulting two axes have different lengths.

I believe it would be better if you used the properties HorizontalZoomRangeStart and HorizontalZoomRangeEnd of the RadCartesianChart. You will be able to bind the respective properties of the two charts and this way you will not need any code behind logic.

<telerik:RadCartesianChart x:Name="chart0"
HorizontalZoomRangeStart="{Binding ElementName=chart1, Path=HorizontalZoomRangeStart, Mode=TwoWay}"
HorizontalZoomRangeEnd="{Binding ElementName=chart1, Path=HorizontalZoomRangeEnd, Mode=TwoWay}">

Please, let me know if you have any questions or concerns.

Regards,
Anna
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Alberto
Top achievements
Rank 1
answered on 05 Aug 2015, 12:50 PM

Hi Anna,

thank you very much for your suggestion.

Now the scrolling seems to work correctly.

Regards,

Alberto 

 

Tags
ChartView
Asked by
Alberto
Top achievements
Rank 1
Answers by
Anna
Telerik team
Alberto
Top achievements
Rank 1
Share this question
or