-
1 Attachment(s)
Graphing a function
How hard would it be to graph a curve of a function in a VB form.
Attached is a graph from excel which is exactly what I need to do.
I have the function of some fluid properties and I'd like to choose a min and max temp then have the function graphed, with temp as the x and the fluid property as the y which would auto scale to fit the curve.
Actually now the program i have to return the properties at one temp is just a GUI front end to call a fortran program to return the properties so actually if I just use that it'd be graphing points and not directly from the function. I can always make it completely VB based if graphing from a function is easier than points. It'd be a slight pain to rewrite all the code for the functions though.
-
Re: Graphing a function
How hard? Well, it varies from dead easy to impossible for any given scenario.
VB dosn't have any built-in charting or graphing functionality at all. Al it can do is draw lines, curves, images and text based on some discrete values. If you want a tick mark, you have to draw it yourself. If you want a text value at that tick mark, you'd have to draw it yourself.
It isn't hard in the same way that building a 19th century replica wardrobe isn't hard: it's just a few tools and wood, right? ;)
So, based on that, you have several options:
Use a 3rd party charting control;
Use excel;
Draw it yourself.
-
Re: Graphing a function
As SJ said, there is noting out of the box with vb.net, but there are chart controls available from MS that you can use:
http://www.microsoft.com/downloads/d...displaylang=en
-
Re: Graphing a function
Yes, MS has one; I'd forgotten to add that the best bet would be a separate control or automating Excel rather than a DIY approach. I'd say discard the DIY approach simply because of the learning curve involved, albeit an excellent learning experience.
Personally, I like the DIY approach, simply because I have been creating charts and graphs with VB for about ....well, too long... so have quite a bit of a codebase to draw (no pun intended) upon.