graph dispay and labeling using VC++

Given an equation, let say f(x) = 20exp(-2x), how can i display the result of this equation , including labelling  the x and y-axis and the graph titile?
kitleeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

viktornetCommented:
you have to parse the equation first.. there's plenty of code on the net for parsing equations (try Yahoo or AltaVista)... once you have parsed the equation and you have the values you need, you could graph it using Win32 functions such as SetPixel() (which is dog slow) or could use some other functions... it's your choice...

..-=ViKtOr=-..
0
jhattinghCommented:
Once you have your equation results, say, the x and the y, use the following functions to draw to, for example, a CDC:

///////////////////////////////////////
For Labeling the axis:
///////////////////////////////////////

BOOL TextOut( int x, int y, const CString& str );

or:

int DrawText( const CString& str, LPRECT lpRect, UINT nFormat );

To draw the text VERTICALLY, you will need to employ workaround methods, like draw to a separate memory dc, rotate it and then blit it to the screen's dc, but that's another topic on it's own!!

///////////////////////////////////////
For Plotting the lines or values:
///////////////////////////////////////

Depending on how fast the data comes in and how you want it displayed, you could use either of the following methods:

CPoint MoveTo( int x, int y );
BOOL LineTo( int x, int y );

This is probably more desireable. Use these two functions to draw a line from the last point plotted to the new x,y

or:

COLORREF SetPixel( int x, int y, COLORREF crColor );

which is quite slow, but wouldn't be noticeable for most graph usage, IMO.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.