I have a XamDataChart that I created that receives live data every second. I needed the ability to allow the user to pan and scroll the view and when the user is not looking at the right axis I needed the view to be static but still indicate that data was flowing in. To accomplish this I had to check see if the user was looking at the far right by adding the ActualWindowPositionHorizontal and ActualWindowScaleHorizontal together to see if it equals 1. If not then the user either panned or zoomed and therefor I need to keep the view static. To accomplish that I handle the OnWindowRectChanged event and I shift WindowPositionHorizontal 1 second to the left and shrink the WindowScaleHorizontal to the appropriate amount to maintain the exact position and size until the user resets the view to the far right. I have this working,however, now I have 3 XamDataCharts linked via the SyncManager. I have all 3 charts' series' xaxes' Minimum and Maximum vales bound to the same viewmodel properties as I did in the control with only a single datachart. What I find is that as soon as one fires the OnWindowRectChanged is fired the others fire as well and this causes a recursion error and the app crashes. What I need to know is how am I supposed to manually update WindowScaleHorizontal and WindowPositionHorizontal properties on synced datacharts? Is there a way to make the user's view "fixed" when zoomed/panned without modifying the position and scale each time the datasource gets more data added to it and the xaxes' MaximumValue is increased? Should only one of the charts xaxes' MaximumValues be bound to the viewmodel since they are synced?
I am attempting to come up with a sample to reproduce my problem but the charts have a lot of companion code that is making it time consuming.
Please let me know if you need more detail.
Hi Mike,
It is expected that the other charts would fire the WindowRectChanged since the panning/zooming is linked. What is the code that you are running inside the WindowRectChanged event? I have a sample up with 4 synchronized charts and "live" data streaming in every second.(I'm just generating a random data point and adding it to the data source every second)
Also from my understanding of your requirement, the data chart should already be able to do that by default. That is, keeping the view static while data flows in. As an example, in my sample I adjust the horizontal zoombar scale to zoom in horizontally and then pan the chart all the way to the right. The view will stay there and you can see the data flow in from the right, moving to the left. And since all my charts are synchronized, they all perform the same way. I've attached the sample to this post. Is this not what you were looking for?