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)
Hello Mike,
I have been looking into this for you and since I wasn’t able to follow through your implementation, I did one of my own (DataChart_liveUpdate_scrolling.zip). In the sample there are animations to make data transition smooth and a few buttons. In order to start and stop the animation you can click on the text in the middle of the XamDataChart, which would allow you to change the position of the horizontal scrollbar uninterrupted.
Please let me know, if I can be of any further assistance on the matter.
Thanks Petar.
So building off your example, as data is coming in I need to be able to move the zoom thumb slider. In your example the scrollbar would not drag or resize very well. Another feature is that when the user is viewing the far right data should be moving to keep up with the live data, however as soon as the zoom thumb is moved from the far right at all the view needs to remain fixed at the selected times. During the time that the view is fixed data should still be flowing in and that should be apparent by the scroll bar thumb shrinking as the full timeline continues to grow.
Does that make sense?
I am just checking if you got this worked out, or you still require any assistance, or clarification on the matter.
If this is what you were looking for please verify the answer so it helps other users as well.