Results 1 to 2 of 2
  1. #1
    silvia is offline Member
    Join Date
    Jul 2007
    Posts
    35
    Rep Power
    0

    Default Help with graph code example

    Hi, I've been trying so long and i could not solve any of the problems (below) that I've been having for some time. If any of you could help out with any of the problems, that's be absolutely amazing.

    1. Graph Class Library
      that's the website from which i got my plotting codes/classes for a plot that supposedly takes a set of data from a different calculating program (example 3 code is the one where you can load data). I'm looking at the graph code example3 and it's not obvious to me how to call up the data for the graph. is it where it says "DATA"? if the data file is called output.txt would i just substitute "output.txt" for "DATA"?
    2. How would i make it so that my outout.txt file from a calculating program is composed of two columns (so basically a set of data, x coordinates and y coordinates)?
    3. In the following equation, i want P to be varying b/t two given constants Pmax and Pmin. how would i do that?


    public double I0(double Vb, double P, double Pbath) {
    return ((Pbath-P)/Vb);
    }

    Thanks

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    I'm looking at the graph code example3 and it's not obvious to me how to call up the data for the graph. is it where it says "DATA"?
    This line in the applet
    Java Code:
    String data  = getParameter("DATA");
    reads the data file name from the applet tag. To find it you look at the source (View menu/Page -> "view source") and find that the applet is in the middle row of a frameset. Copy the url ("example3_app.html") for this frame and load it into the address bar. The applet tag has the param tag
    Java Code:
    <param name=data
           value="elliptical.data">
    which shows the data file name for the applet.
    if the data file is called output.txt would i just substitute "output.txt" for "DATA"?
    If you want to use the applet tag and its param tag you would substitute "output.txt" for the value of "elliptical.data". If you want to put it directly into the applet you could write
    Java Code:
    String data  = "output.txt";
    How would i make it so that my outout.txt file from a calculating program is composed of two columns (so basically a set of data, x coordinates and y coordinates)?
    Make up a BufferedWriter to write the data out to the "output.txt" file. For each x, y value skip a space in between and after the pair write a newline with myWriter.newLine().
    In the following equation, i want P to be varying b/t two given constants Pmax and Pmin. how would i do that?
    Let's say you have data 250 <= x <= 1000 and want to scale it into 50 <= y <= 100.
    To scale the units
    Java Code:
             100 - 50
    scale = ----------
            1000 - 250
    Scale the x interval and add the minimum y value.
        50(x - 250)
    y = ----------- + 50
            750

Similar Threads

  1. Java chart & graph lib
    By saturdaybugs in forum Java 2D
    Replies: 1
    Last Post: 04-24-2008, 02:59 PM
  2. Need Help for Dot Plot Graph
    By BHCluster in forum Java 2D
    Replies: 5
    Last Post: 04-15-2008, 03:54 PM
  3. Graph program code,hardnut
    By Javashak in forum Advanced Java
    Replies: 0
    Last Post: 03-24-2008, 04:25 PM
  4. Graph DPS and BFS implementation
    By hey in forum New To Java
    Replies: 1
    Last Post: 01-09-2008, 10:19 PM
  5. Problems getting Graph to show
    By rhivka in forum New To Java
    Replies: 6
    Last Post: 07-31-2007, 06:21 AM

Posting Permissions

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