I’ve made some code which enables you to plot some data on a graph. It’s pretty simple method - just builds the graph from a StackPanel of columns 1 pixel wide with a red pixel at the corresponding Y-value (in my case temperature).
It works well, building the graph based on my internally calculated data, but what I can’t seem to do it get it to re-draw when the data changes. The bruit force way I’ve built it is what I suspect to be the problem - there is an Image array with the hundred and sixty 1x160 pixel bitmaps (giving the temp range 16 to 24 in 0.05 degree increments.
I’m just wondering if anyone else has built a graphing tool, if people would be interested in this or have any ideas on how this could be improved.
[I’m coding on the EMX, but Mods please move if this should be in a different forum]
For this, it is highly recommended that you use Bitmap class directly, no WPF
I really didn’t get on with the Bitmap class - it seemed much less capable for building a complex multi component display. Plus all the C# books went down the WPF route with a
call and various windows.
Why would the bitmap class be preferable?
Here is a view of my main screen display (I’ve pixelated for copyright issues)
Bitmap class is highly optimized and you don’t have WPF overhead. You can also go with RLP and you will get the best performance that way. Wouter has a nice demo:
Much, much faster! http://wiki.tinyclr.com/index.php?title=GHI_Graphical_Demo
You can always have a combo of both in your application.
I see the rotating bitmap is quite speedy, and the came of space invaders is cunning, but I have to say I’m having quite some success with the WPF and I think (from my reading of the books) that separating the display from the code helps keeping them updated as needs be.
I’ve already found it pretty easy to add another display element to my screen simply by cutting a bitmap into two and referencing each to display the state of two variables (picking the image file corresponding to the variable state).
I’m not suffering any speed problems - redraw time is pretty instant (even my mamouth 160 component graph takes just a few seconds to build).
I see I’ve not got many WPF friends out here. But if there are any please say hello.