I want to make a graph of several ROC curves in WPF. I've found the WPF Toolkit, but I don't see an out-of-the box solution for what I want, just several basic graphing types. Is it possible to build an ROC curve (preferably, an ROC convex hull curve) in the WPF Toolkit? Once it's built, is there an easy way to get the AUC? Or is there an off-the-shelf solution I can just use?
Basically, I want a graph that looks like these graphs, but nicer and scaling with resolution.
It seems to me that you'll need to learn using WPF PathGeometries. I haven't used them much, but from what I learned, I think it's possible to do the ROC curves.
If you want scaling, resolution, zooming. I think you'll be better of getting something that is already done like Telerik, Infragistics, DevExpress or ZedGraph. Otherwise you're likely to spend a lot of time implementing it yourself.
I used ZedGraph to create nice ROC curves, even with the color scales at the side.
It is not so hard to do, you just need to use ZedGraph's custom LineObj objects.
Here's example of using ...Obj objects in ZedGraph (you can add LineObj to the chart just as it is done with TextObj or ArrowObj there).
I went with the visifire controls, and then added in a first series for the points and a second series for the convex hull.
Related
I'm designing a game and thinking about using WPF for making a simple prototype of the basic gameplay.
Is it possible to render basic 2d-graphics in WPF in real-time? By basic graphics I mean simple shapes such as lines, circles, etc. By "real-time" I mean things are rendered based on parameters such as velocity, acceleration, etc. that changes depending on player input - which I assume means I can't use storyboards for the animations.
Thanks
Check out the previous question High Performance Graphics using the WPF Visual Layer for a good related discussion. While WPF provides a great framework for rich vector graphics, it lacks somewhat for real-time 2D performance.
There are workarounds, for instance, depending on your scene complexity you may get away with using DrawingVisuals or virtualized Shape classes (WPF Vector graphics) to draw your sprites. Going a little lower level, you could cache sprites using the BitmapCache mode available in .NET4.0, or pre-prendering them to Bitmaps and using various optimization patterns to improve throughput.
Going lower level still, you can mix Vector/Raster graphics using the fantantastic WriteableBitmapEx project, or Vector/GPU graphics using the D3DImage.
Regarding how to update your scene, you'll need to write a primitive game engine where on the CompositionTarget.Rendering event (fired on redraw of the screen) you get the updated parameters and compute positions/orientations of your sprites. Something that might help with this is this great codeplex project which integrates WPF/Silverlight and Farseer physics.
This is not a generic question on collision detection, so please read it till the end.
In my wp7 game, i represent all my objects as rectangles, and use the the Intersect() method to check for collisions between 2 rectangles, which works great.
I was thinking of enhancing the accuracy by drawing the objects as polygons instead of rectangles.
Is there a built in api such as the Rect.Intersect() that works for Polygons ?
More generic question: Is there a better approach other than the Rect.Intersect() one which utilizes .net api's and does not involve implementing collision detection algorithms?
There is no baked in equivalent for polygons collision detection in silverlight. There is a similar question asked here. But there is a Polygon Object JIC you didn't already know
I am considering using Silverlight for a project I am working on. This project will need to show a 3-Dimensional cube. Is this possible in Silverlight?
I see a lot of examples that a basically 2-sides of one item. Kind of like a sheet of paper. Is this what "perspective" 3D is? How is perspective 3D different than normal 3D?
Thank you!
You should look at Kit3D for Silverlight. Someone also created a silverlight3d.com site, but it current just has three reference articles and a link to Kit3D.
It is also possible to emulate 3D as demonstrated by this MSDN article.
The feature that was added in Silverlight 3 is referred to as "perspective 3D" to avoid confusion that might arise with someone expecting it be some kind of full scale 3d rendering API (like DirectX or OpenGl etc.) or something like WPFs UIElement3D.
The "perspective 3D" feature in Silverlight allows you to take any regular 2D UIElement and rotate it in 3D dimensions; you can think of it like a more powerful RenderTransform. There are two ways of setting a "Projection" on a UIElement, with a PlaneProjection (simple) or with a Matrix3DProjection (more complex).
You could certainly use this feature to create a 3D cube, where each face of the cube is a UIElement with a Projection applied to it. However you would not use this feature to create something that required complex 3d models such as a 3D game.
currently im taking a Master degree course in Computer Sciences, and i´d like to implement a Cellular Automata in WPF. The rendering performance must be enough to display
a lattice (grid) containing 200,000 cells.
Since updating visuals is very slow in WPF (due to the visual and logical tree), maybe it's better to use old good Picturebox (GDI+) to do the rendering and WPF to implement the rest of the software. A second option would be to use pixel shaders (HLSL), but i'dont know if WPF supports multi-pass shaders.
Let me know what you think.
First, check out the WriteableBitmap. The performance is decent, but nowhere near a shader can provide. I'm not exactly sure what kind of shaders are supported, but I'd think it wouldn't be limited...
Found this over on WindowsClient, it doesn't seem like multipass shaders are supported currently. Again, its probably just a matter of time and demand on that code; it may have been added since the article was written.
Somebody +1 me for not mentioning the Game of Life.
Approaching Silverlight development is a rather daunting task as it seems to require a rather different mindset to work I have done in the past.
I have been working on it for several months and we have already released an application that presents form-based pages. So I have the basics of XAML for layout but what I need to do now is move into graphically representing data. For example transform a list of objects representing vehicle speed recordings into a line graph of speed. I am at a loss on what the best way is to approach this.
Can anyone point me to articles or tutorials that present this kind of thing?
Your first port of call for Silverlight learning should be the official site http://silverlight.net/Learn/
If you want to do any data visualization/charting then first try the Silverlight Toolkit on codeplex. It's fantastic if you want to get anything up and running quickly.
Also check out Delay's Blog on charting and the chartbuilder code
Bang your head against it for 3-6 months. That's how I did it and it's worked out pretty well so far.
But seriously, the learning curve sucks.
There's charting libraries for Silverlight out there, you could grab one of those but I wouldn't waste money on it. It's relatively easy to write this kind of code yourself.
All you really need is a DrawingVisual. Once you have that you can render what you need on to it's surface. The trick is to make sure that you have sufficient layout information when you render. Because this is vector graphics, you can use the ScaleTransform to match your content bounds instead of repainting on size changed. Other than that, you'll wanna host your DrawingVisual in a UIFrameworkElement and let the dimension of that object govern where and how you draw your data. This will give you all the layout goodness of WPF/Silverlight.
For drawing there are plenty of Geometry classes you can rely on but there's one thing that you'll wanna do and that's to adjust the level of detail in your data points with respect to your drawing. This is the number one trick to make sure you don't hog the CPU.
Avoid drawing more than one data point per pixel. If you have a lot of data points, and a small drawing surface you can use a rolling average to smooth the result.
If you approach this with the above things in mind you should be able to write a flexible graph UI element that you can visualize data with, in no time at all.
I did this in a WPF application, I'm pretty much assuming that you can do the exact same thing with Silverlight 2.0, you'll just yell at me if you cant?