Results 1 to 4 of 4

Thread: Graphing a function

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2008
    Posts
    163

    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.
    Attached Images Attached Images  

  2. #2
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    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.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    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

  4. #4
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    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.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width