Janman
Janman

Reputation: 698

Plotting a graph in C++ window

I want to plot a graph out of simple functions/set of coordinates in a window. I know the c++ win32 basics and I can make a simple window with buttons and other control objects. But which is the fastest and easiest library to plot a graph to my program?

Upvotes: 3

Views: 8131

Answers (2)

Flot2011
Flot2011

Reputation: 4671

Here is the light, easy to use library: http://www.codeproject.com/Articles/1546/Plot-Graphic-Library

Upvotes: 2

rkosegi
rkosegi

Reputation: 14638

I expect you are using Win32 API (not CLR).

Theory is easy, you need to obain device context withing WM_PAINT message. You can use main window or any child window (control - static, button) inside main window.

Here are some usefull links: http://www.codeproject.com/Articles/2078/Guide-to-WIN32-Paint-for-Intermediates

http://www.codeproject.com/Articles/66250/BeginPaint-EndPaint-or-GetDC-ReleaseDC.aspx

eg:

case WM_PAINT:
    BeginPaint(hWnd, &ps);
    LineTo(ps.hDC, 30,30);
    EndPaint(hWnd, &ps);
return 0;

This will draw line from 0,0 to 30,30

Upvotes: 2

Related Questions