views:

498

answers:

3

Okay, I bet this question might have been asked dozens of times before, but at the end of the day, I am still confused.

I am working on a charting/plotting application. My application will also have WinForms controls.

Edit: Actually it's little bit more than a simple charting application. I need to plot hundreds of symbols on the plot. Additionally, the plot will be interactive, e.g., selecting, moving or editing the symbols, adding/editing text on the chart itself. WPF seems to be answer as far as the replies are concerned, but I am still skeptic whether it will scale well. Any second opinions?

My current options are:

  1. GdiPlus: Seems best, but does not supports hardware acceleration.
  2. WPF: Practically, its still too slow.
  3. SlimDX: Might be overkill
  4. Tao: Don't know much yet
  5. XNA: ditto

Since I plan to use Windows 7 features in my application, So this will be a blend of WinForms and custom graphics.

Any help or links comparing the above would be greatly appreciated.

+7  A: 

Of all those options, assuming you're discarding off-the-shelve control libraries for charting/graphing - WPF seems to be the easiest way to integrate any graphics with WinForms (if you can, why not go all the way and make everythingin WPF?).

Have you seen this famous WPF Graph Example here?

To give you an idea, I put something like 16 graphs on my desktop/laptop and it works very well. Also tried it out on embedded graphic cards (very small devices) and still I was able to render at a decent refresh rate up to 4 graphs simultaneously.

Before worrying about performance you really need to do some benchmarking on your spec.

JohnIdol
+1 for the comment about benchmarking before worrying about performance. I totally agree.
Simon P Stevens
Should also mention WPF 4 which will integrate features from Windows 7
Peter Lillevold
+1 for link to online WPF Graph Example demo. That was cool! I especially liked being able to just click on the link and immediately see it run using ClickOnce (no download, no install). I ran about 20 instances of this application simultaneously before I saw a noticeable slowdown.
Ray Burns
@Ray Burns - that graph example is very useful as a benchmarking tool!
JohnIdol
WPF has speed issues with > 5000 objects in a 3D environment. So depending on requirements WPF might not be an option.
Cameron MacFarland
Um, this guy says he's working with 2D so that shouldn't be a problem....
RCIX
@RCIX doesn't matter - WPF uses Direct3D calls to render 2D stuff as well - DirectX 2D APIs have been deprecated some time ago as far as I know
JohnIdol
+2  A: 

Another one that might be worth checking out is the MS Chart controls.

There are also some Samples and screenshots here

Simon P Stevens
A: 

We did this type of work for over 20 years now, and the story doesn't change at all.

As you see you haven't got much choice..

The truth is with the entire reluctance and work in graphics vendor wars where you will see for example NVidia cards horribly slow down all GDI+/WinForms code, requiring double-buffering hacks, and what not.

Not only is NVidia or MSFT 'reluctant' to address acceleration or fix issues, they insist on leaving them as is and introducing even slower and horribly painted ListViews, Grids, and much more.. They also sell lots of 'half-technical garbage' on their blogs and support on this issue for over 5 years now.

WPF sucks trunks, it bloats so fast and acts like an Atari pushing Unreal Tournmaent 3. As for approaching ironically-native focus and acceleration (as they should have understood from the beginning/doh!), MILCore is supposed to help a lot with Silverlight and slimmed down CLR. But nope, it doesn't, the browsers now feel like C64.

SlimDX and TAO are probably an overkill and for XNA you'll need widget and toolkits that are starting to spring up. If you even consider doing D2D and Windows 7 say goodbye to much of your audience that simply runs XP because it is around c20% faster and about 300% faster in GDI (classic, most hardware accelerated apps) and nothing WinForm/WPF can even compare close to it...

What you are getting involved in is a dirty part of the industry and one that is littered with politics, perf problems, bugs, stories and silence/reluctance when alternatives are presented. You can still interop into partially accelerated GDI bits, but the mixing of GDI+ and GDI causing other issues as well as bring further complication that has no good workarounds.

But to answer and in hope the above saves you time as it is a long history of it.. If you want good portability, 30 times better perf than WPF or WinForms, the best way forward is to use OpenGL and OpenTK and aim at 2D. You will still see the pathetic JIT-er drag itself at times and you will have some interop work cut out, but the difference in performance is astonishing (because if someone didn't hear, we got 300 times faster hardware, yet 50 times slower apps on .NET these days).

Lastly, use good algo-s not to overload that WPF or WinForms/GDI+ crap with too many points as it chokes so hard and fast on large data sets that kids smash it by 3x faster perf even on ARM/iPhone devices.

[piece to Seattle bloating camp]

rama-jka toti
Are you capable of not writing in hyperboles?
JulianR
nope.. but I know it hurts, which is ok. Just stating the obvious to obvious C# users. Knocked out by iKids.
rama-jka toti
I think that you described it very well. The current situation around .NET/WPF and other stuff is simple: veeeerryyyy slow. Nobody wants to see that. Priority number one: I'm IN as I'm using WPF bloatware...
mnn
Looking at beta 2 of VS2010, it definitely uses a lot of memory (but is that due to WPF?) but its interface is definitely not slower than VS2008, probably faster. And to call .NET slow is just silly and the above post is full of even worse exaggerations. Nuance is entirely absent from it.
JulianR
You obviously enjoy flicker and hanging apps Julian.. if you need to get more technical go into real technical discussion not praising a tech, an approach or otherwise JUST because you bought the bloat stories. Virtualdub.org had a few hints last time I checked it but anyway.. there are hints everywhere, you just prefer to be blind which is ok. It is a typical C# guy reaction to the facts and hard stats..
rama-jka toti
the first tech has the problems with surface locks. the second has the problem of a mass-crowd peanut Java reasoning. That's why you have MSFT writing the milcore stuff for you and VS shaping the work on WPF4.0 and so on. They are finally waking up to the slowest text renderers in the history of mankind and still, it is behaving closer and closer to Eclipse draghouse by the day.. And wow, you chose an editor for comparison.. serious, some reading required and a bit of open-minded approach that not everything is System.Object windozzy..
rama-jka toti
Facts and hard stats? I'm sorry, I must have missed those, probably due to me having my head so far up MSFT's rectum. You're right, I'm biased, you're clearly not and all the evidence you've provided about .NET being "50x" slower certainly convinced me of that.
JulianR
Oh whatever..pointless arguing. One thing works, and that's my job profile and get the numbers for hard cases and complete apps, not trivial examples. You'll see OpenGL not even use 1% of CPU while WPF will hang at around 60% and take 50x longer. Do it yourself Julian, update your gl-drivers and start believing.
rama-jka toti
also, buy yoursleef an iPhone, chose a heavy but good/well-written OpenGL app. Then look at your Xeon which is x-times faster and more capable in many respects, then emulate it and you'll get the numbers easily.. Stress test it, then soak test it and come back and report the factor. Here it is, because you never did such a test: Kids knock out those XAML toys and beat the performance on a crappy 400Mhz that wouldn't even load that <x:Window> before the iPhone did 50 iterations, let alone some interaction that kills the Xeon(as if it was doing nuclear sims and not acting on input).
rama-jka toti
@Majkara: The proof is in the pudding. Can you please recommend a "heavy but good" OpenGL app that I can download a demo or source for to do some benchmarking with? It needs to be able to display graphs that change in real time or provide an easy way to repeatedly display a graph. I plan to duplicate the OpenGL output in WPF and compare frame rates apples to apples.
Ray Burns
I already tried looking for an OpenGL charting app or library with samples I could use for this, but the ones I found just showed static charts so they would be hard to compute frame rate on.
Ray Burns
That's for you to learn as the apis are different, and whatever you write start with WPF and compare.I hear SwordFish chart is good so go for it and look at the darn disaster.Then try something like Infragistics junk.Then you write the OpenGL code and properly. Then just stop and breathe in disbelief or for being foolish and not doing it OpenGL all the time + what you gain is PS2/PS3 support,Apple support, cross platform, cross OS api. Not proprietary and slow bloat, simple.Then hope you'll port Unreal to WPF and not require a max-GUID number of boxes for 30fps that runs fine on NOT-WtPF:)
rama-jka toti
Alternative: find a 400Mhz box. Use the graphics acceleration that is increasingly present in WPF and Windows7 as some bits now are GDI accelerated. Once you're done, get the WPF to run on it. Wait, go make a coffee, buy a milk at the shop, it should be running and displaying 2D or your 3D charts by then. Then just take an iPhone and watch it operate more smoothly on some seriously limited hardware without that Xeon liquid cooling mechanism. Then start timing your WPF hang in soak test and finish around 50seconds while iPhone finishes in 1second ! That's so so so sad..
rama-jka toti
lastly wait for Android phone which won't give you WPF. Or wait for Chrome OS which won't run that bloat either. Why on earth there is such resistance to something that clearly is not DUMB enough to take 60MB for a few buttons and a tab, and behaves like Eclipse overloaded is beyond me.. Oh yeah, LOB keyword.. there goes the lobster lost in markup hell and INotifyBloatedDesigns two-way binding..
rama-jka toti