views:

995

answers:

4

Just a quick question.

I'm looking for a simple strip chart (aka. graphing) control similar to the windows task manager 'Performance' view. And have found a few, but they all rely on MFC or .NET :(

Am hoping that someone here might have or know where to get a simple strip chart Win32 control that is not MFC.

Thanks.

A: 

If you have found a good MFC control, maybe your best approach would be to convert the code yourself to pure Win32 - MFC is a thin wrapper around the Win32 API after all. Out of interest, what is the name of the MFC control you found?

ChrisN
A: 

Same controls but..

MFC version: http://www.codeproject.com/KB/miscctrl/C2DPushGraphByStuart%20Konen.aspx

C# version: https://secure.codeproject.com/KB/miscctrl/C2DPushGraph.aspx

:/

Sebastian Dwornik
A: 

I don't think there is a standard one in the Win32 common controls library. You'll either have to use someone else's widget library, or roll your own using GDI to draw the graphs. It probably isn't too difficult to roll your own - just create a bitmap control, and set the image every time your data updates to a graph that you draw in memory.

Adam Rosenfield
I think that seems like overkill. If we're talking Win32 GDI there's no need for a "bitmap control". Just handle the paint message and get the DC, draw into that!
Aardvark
Drawing onto your DC directly will cause flicker. Although the 'bitmap control' approach is a bit strange IMO, for a custom MFC control you need to handle WM_PAINT, create an in-memory bitmap and draw into a memory DC at the very least.
Roel
+1  A: 

If you have to go the roll-your-own route look at the polyline GDI call. That can draw the entire line for you in one call.

I work on a system that draws charts with custom code (no 3rd party controls, all win32 GDI). It sounds really hard, but it isn't that bad.

A little math to map the points from your coordinate space to the device context, drawing gridlines/backgrounds, and Ployline. Done! ;)

Heck you can use GDI mapping modes to make the math easy (but I wouldn't).

Aardvark