Sign in to follow this  
mettafort

[.net] WPF / Scrolling graphic left to right in 2D

Recommended Posts

Hi, I need to build something that will render a graph, but I can animate the graph too, and it needs to be in WPF. For example, we have a timeline of events a user has done in a game, and the idea is that we would show a nice graph of their timeline when they go to a certain profile screen. These details arent so relevant. More relevant is that I have a time series of data and I need to render it to a view in 2D. When the user scrolls manually I need to move along the timeline. From a WPF perspective I am not exactly sure how to go about this. I was thinking that I draw each item that should be visible, and if the user scrolls to the right, I work out which items are no longer visible and simply ignore them and just redraw the full set of items that are now visible. What concerns me a little is that this feels like it might not be efficient enough, so I am wondeirng if people have tips or some links to possible examples? I am very new to WPF. Thanks, MF.

Share this post


Link to post
Share on other sites
Thanks for replying. This graph will be displayed on the screen and will represent an ongoing flow of data. Just like the Windows Performance Graph in the Task Manager, I need to draw a similar (in nature) graph. The data +/- so many samples is basically constantly changing, so I am not sure drawing the whole graphi on a canvas and a scrollview will achieve what I need - would be much simpler to do that way though.

MF.

Share this post


Link to post
Share on other sites
Hi ChaosEngine,

Thanks for your time in replying, I do appreciate it. I will have a think about what you suggest. I am wondering whether i step back from using WPF controls altogther and look to rendering the pieces myself in a more manual sense. I have had performance problems in the past using and moving WPF elements and while I am sure much of this can be mitigated, I did end up with a skewed final design...

If you have any tips on how one would do this using good old OpenGL or just plain GDI that would be helpful...

thanks again,

MF.

Share this post


Link to post
Share on other sites
I had to do something similar a while ago and found the WriteableBitmap class to be the best solution (for my specific purpose). It probably depends how fancy-looking your graph is and if you want to do all the painting at such a low level.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this