You may draw yourself (in
OnPaint
handler) using graphic primitives (
GDI
or
GDI+
) or you may use a chart control, like, for instance, Cedric's
High-speed Charting Control[
^].
[Update]
Suppose you have an array of coordinates and want to create a linear graph.
First you have to find
xmin, xmax, ymin, ymax
in order to scale (and translate) all the coordinates to fit into the screen rectangle you intend to use:
x[i] = rcx + rcwidth/(xmax-xmin)* x[i];
y[i] = rcy - rcheight/(ymax-ymin)* y[i];
where
rcx, rcy
are the coordinates of the top-left point of the screen rectangle and
rcwidth,rcheight
are its dimensions.
Finally you have to draw all the lines connecting successive points, e.g.
MoveToEx(hdc, x[0], y[0]);
for(n=1; n<N; ++n)
LineTo(hdc, x[n], y[n]);
[/Update]