Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3590
Problems customizing scroll and zoom on XamDataChart
posted

I am using the XamDataChart to show several time based series of data. I hide the x and y axis of each series but I display a separate numeric x axis. I have minimum and maximum values of all x axes bound to the same view model property to keep them in sync. What I am trying to accomplish it to have the horizontal scroll bar indicate how much data is available and the relative position of the data being viewed compared to the full timeline. The tricky part id live data is coming in every second so the maxvalue is always increasing. 

I have attached a sample that demonstrates where I am now. If the zoom bar is at the far right so that we are observing live data it all works fine. However, if the user scrolls back in time a little I set a flag called zoomed which I use to try to make the viewport stay in sync with incoming data in order to keep the data from moving. Since I am adding 1 second of time on a timer, I thought all I needed to do was to shift the WindowPositionHorizontal by 1 second as well and then adjust the WindowScaleHorizontal to also account for the added second. However, this logic is not working and I cannot seem to find the right calculation to make it work. The second thing I noticed is that as the user scroll to the left the graph movment gets less and less. I assume this is because the minimum value is fixed but is means the algorithm I use to shift the viewport will need to change as the user scrolls to the left. The reason for this is to show the user that data is still coming in meaning the scrollbar should appear to be moving to the left as well.

Please see the attached sample and let me know if my issues make sense and if there is a way to accomplish what I want. If there is a more standard or practical way to accomplish my I am open to that as well.

An added problem with this auto shifting is that since I am programmatically shifting the position and scale, if the user tries to scroll, the scrollbar will be reset which prevents the user from being able to scroll at all (unless they are faster than a second)

XamDataChartSample.zip