Java & graphs?

Hi is there anyway to create a graph in java without having to build one with shapes etc or using 3rd party programs? If not can anyone recommend any good free 3rd party programs please?

Umm, yep. There's heaps of them. I've played with JFreeChart, and seemed fairly straight forward, if it's somewhat limited in it's capabilities.
It might be worth looking at... but I'd also be interested to see what others recommend.

Similar Messages

  • Invoking Sample Java Graphs thro Oracle Express 6.3.2

    We have installed Oracle Express 6.3.2 to develop OLAP web application.
    At the outset we tried to invoke sample Java Graph Pages created
    using the samples.db after setting the page as JAVATABLE type through the link http:\machineid\oew-install\sample\index.html.
    oew-install is the virtual directory that points the path -
    oxhome\olap\oes632\owa632
    We could only view the OLAP cube as HTMLTABLE type.
    Where are we wrong in not viewing the Graphs???
    Have we missed anything during installation??

    Hi Aneel
    Thanks for your support.
    As per your sugessions We have checked the browser options, we could not find the Java 2 option but we had three options under microsoft VM which are as given below
    1. Java Console Enable
    2. Java Login Enable
    3. JIT compiler for virtual macine enabled.
    We have checked 1 and 3 options and restarted the IE browser still we could not succed in getting the Java Graphs in Sample appication.
    More over as asked by you the version of Java console is "Microsoft (R) VM for Java, 5.0 Release 5.0.0.3234"
    With netscape it was showing "Applet owagraph can't start : Error"
    Hi Can I have your mailId?
    Thanks
    Nanda Kishore

  • Java Graph code explanation

    Hi all,
    im new to java and have some trouble drawing a graph i looked up some code but dont quite understand it
    can someone explain the following code please. I understand swing and painting and basic java.
    Q1) Can please explain the flow of execution ?
    Q2)
    What i would also specifically like to understand about the code
    is how does the graph keep going and looks like it scrolls across and not off the frame and how can i add this to a frame i already have
    without covering over my other objects i have displayed.
    Any help would be greatly appreciated.
    Thanks
    import java.awt.*;*
    *import javax.swing.*;
    import java.awt.event.*;*
    *import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;*
    *import java.math.*;
    import java.util.*;*
    *public class ecg extends JFrame*
    *     myView view = new myView();*
    *     Vector vr   = new Vector();*
    *     int    ho   = 0;*
    *public ecg()* 
    *     addWindowListener(new WindowAdapter()*
        *{     public void windowClosing(WindowEvent ev)*
    *          {     dispose();*
    *               System.exit(0);}});*
    *     for (int i=0; i < 5000; i++)*
    *          int p = (int)(Math.random()*  260);
              vr.add(new Point(0,p-130));
         setBounds(3,10,625,350);
         view.setBounds(10,10,600,300);
         getContentPane().add(view);
         getContentPane().setLayout(null);
         setVisible(true);
         while (ho < 500-300)
              try
                   Thread.sleep(110);
                   ho = ho  +1;+
    +               repaint();+
    +          } catch (InterruptedException e) {}+
    +     }+
    +}+
    +public class myView extends JPanel+
    +{+
    +     BufferedImage I;+
    +     Graphics2D    G;+
    +public myView()+
    +{+ 
    +}+
    +public void paint(Graphics g)+
    +{+
    +     if (I == null)+
    +     {+
    +          I = new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_INT_ARGB);+
    +          G = I.createGraphics();+
    +     }+
    +     G.setColor(Color.white);+
    +     G.fillRect(0,0,getWidth(),getHeight());+
    +     G.setColor(Color.gray);+
    +     Point p1,p2;+
    +     p1 = (Point)vr.get(ho);+
    +     int x = 0;+
    +     for (int y=1; y < 600; y++)
              p2 = (Point)vr.get(y+ho);
              G.drawLine(x,p1.y+150,x+6,p2.y+150);
              p1 = (Point)vr.get(y+ho);
              x = x + 6;
         g.drawImage(I,0,0,null);
    public static void main (String[] args) 
         new ecg();
    }

    Compiling your posted code gives a compiler warning:
    C:\jexp>javac ecg.java
    Note: ecg.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    C:\jexp>javac -Xlint:unchecked ecg.java
    ecg.java:31: warning: [unchecked] unchecked call to add(E) as a member of the raw type jav
    a.util.Vector
                vr.add(new Point(0,p-130));
                      ^
    1 warningWe can eliminate this by changing this
        Vector vr   = new Vector();to this
        Vector<Point> vr   = new Vector<Point>();The best way to understand things like this is to start a new file and slowly build it up so you can see what's going on, step-by-step. I've put in some comments and print statements to give you a start.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;
    import java.math.*;
    import java.util.*;
    public class ECG extends JFrame
        myView view = new myView();
        Vector<Point> vr = new Vector<Point>();
        int    ho   = 0;
        public ECG()
            addWindowListener(new WindowAdapter()
                @Override
                public void windowClosing(WindowEvent ev)
                    dispose();
                    System.exit(0);
            // Initialize data in Vector.
            for (int i=0; i < 5000; i++)
                int p = (int)(Math.random() * 260); // range: (0    - 260]
                vr.add(new Point(0, p-130));        // range: (-130 - 130]
            System.out.println("Total number of data points: " + vr.size());
            setBounds(3,10,625,350);
            // Component drawing space is 600 wide by 300 high.
            view.setBounds(10,10,600,300);
            getContentPane().add(view);
            getContentPane().setLayout(null);
            setVisible(true);
            // Animate up thru the first 200 of 5000 data points.
            int millisPerSecond = 1000;
            long delay = 110;
            long framesPerSecond = millisPerSecond/delay;
            System.out.printf("Frames per second: %d%n", framesPerSecond);
            int paintSteps = 600;
            int dataIndex = 200;
                            //5000 -1 - paintSteps;  // max possible index
            System.out.printf("Expected animation time: %f seconds%n",
                               (double)dataIndex/framesPerSecond);
            long start = System.currentTimeMillis();
            // Animation loop.
            while (ho < dataIndex)
                try
                    Thread.sleep(delay);
                    // Increment "ho" which will step us through the Vector data.
                    // Each new value draws the Vector graph data starting at
                    // index "ho" placed at the left edge of the image/component.
                    ho = ho + 1;
                    long end = System.currentTimeMillis();
                    double elapsedTime = (double)(end - start)/millisPerSecond;
                    if(ho % 100 == 0)
                        System.out.printf("ho: %d  time: %.2f%n", ho, elapsedTime);
                    // Update the image in the paint method.
                    repaint();
                } catch (InterruptedException e) {
                    System.out.println("animation interrupted");
            long end = System.currentTimeMillis();
            double elapsedTime = (double)(end - start)/millisPerSecond;
            System.out.printf("Total animation loop time: %f%n", elapsedTime);
        public class myView extends JPanel
            BufferedImage I;
            Graphics2D    G;
            public void paint(Graphics g)
                if (I == null)  // initializw image
                    I = new BufferedImage(getWidth(),getHeight(),
                                          BufferedImage.TYPE_INT_ARGB);
                    G = I.createGraphics();
                // Update image to show current state of animating graph.
                // Fill Background color.
                G.setColor(Color.white);
                G.fillRect(0,0,getWidth(),getHeight());
                // Set graph line color.
                G.setColor(Color.gray);
                // Draw next data segment to newly-erased image.
                // Get two points in data to draw the next line.
                Point p1,p2;
                // "ho" is a simple counter with range [0 - n-1]
                // [0 - 200-1] in the animation loop above.
                // Get the next data point at "ho" which will be drawn at
                // the beginning, ie, left edge (x = 0), of the image.
                p1 = vr.get(ho);
                int x = 0;
                // Since each frame starts at zero_x relative to the image:
                // x = 0.
                // Draw all graph data for this one 600 by 300 image frame
                // with data beginning at index "ho".
                for (int y=1; y < 600; y++)
                    // Get the next point out ahead.
                    p2 = vr.get(y+ho);
                    // Draw a line from the last point, p1, to the next point, p2,
                    // which will be spaced (x +=) 6 apart along the image/component
                    // width of 600 (setBounds). Translate the y values down onto
                    // the component by 150 pixels (the range of y values from
                    // above is from -129 to 130). The "+150" shifts the y values
                    // to the approximate center of the component.
                    G.drawLine(x, p1.y+150, x+6, p2.y+150);
                    // Save the current point to/in p1 for the next iteration.
                    p1 = vr.get(y+ho);
                    // Move along to the right in the image.
                    x = x + 6;
                // Draw image in component.
                g.drawImage(I,0,0,null);
        public static void main (String[] args)
            new ECG();
    }

  • [Graphs in Java] Graphs library

    Hi there,
    my name is roberto...i want to know if exists a library to construct a graph in java....
    please answer me .. tks

    Sorry--I guess I misinterpreted "graphs".
    Tried googling (neural net java):
    First hit:
    http://rfhs8012.fh-regensburg.de/~saj39122/jfroehl/diplom/e-index.html
    Lots (418,000) of other hits, too. Probably one of them will suit your purposes.

  • Java Graph ADT

    I need some help and I am quite lost. I need to develop a Graph in java.
    I understand that the graph has vertices and edges. I developed two classes of vertex and edge. I just don't understand how to implement them in the class Graph.
    This is homework, but i am so very confused...

    An edge has exactly two vertices.
    A vertex can have an arbitrary number of edges.
    A graph is a collection of edges and a collection of vertices, and they have to make sense.
    If I recall my data structures classes from long ago, graphs don't necessarily need to be connected. You can have standalone vertices or bunches of vertices which don't necessarily interconnect.

  • Java graph

    Hi all
    I am developing a GUI in java where the user answers a selection of multiple choice questions.
    I would like to give some feedback to the user in the form of graphs or charts.
    Does anyone have an ideas how i might be able to do this? Does java have any tolls included to help or would I maybe have to use a third party library.
    Thanks for youre help

    Get yourself a copy of JFreeChart. It's a 3rd party library for graphs and charts.

  • Java graph library

    Hi all,
    I am developing a web application.In one of the jsp pages i need to display a tree with some nodes.
    Is there any library (preferrably open source) which will take inputs and construct a tree and capable of creating a image file.
    Hashin

    Hi,
    You can use Java Applet with JTree object. Look at this tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
    or JavaScript based solution like this:
    http://www.treeview.net/treemenu/demos.asp
    or even Ajax solutions. For example:
    http://www.twinhelix.com/
    Good luck!

  • Saving the Java Graphis Object to JPEG File Format

    Hi,
    I created many java graphics objects on my applet (standalone) and would like to save it in one jpg format.
    Any idea how to do this??.
    I would appreciate for any hints.
    regards
    Paulus

    It is easy in Java.
    See com.sun.image.codec.jpeg.* package document
    good luck!
    Louis
    INT

  • Create the graph using java applet

    Hi friends,
    I have one urgent requirement.I need to create the flowchart by using java code.I have data in database.based on that i need to create the parent child relationchip graph..plase anybody help me .
    Thanks&Regards,
    Yousuf alam.A

    malcolmmc wrote:
    JFreeChart has been the favourite Java graph drawing library but, last time I looked, it didn't do flowcharts. If I were you I'd fire up Google and hunt around for a 3rd party library that does. Of course it's a pain if you have to use such libraries in an Applet. It's generally better to generate an image file on a server and display it as part of your html page.Sorry Malcolm but I don't think JFreeChart is applicable. The OP is asking for Flowcharts which are a graph as in nodes and edges. JGraph (Google) is probably what the OP wants but he is in for a shock when it comes to using it.

  • Creating graphs with Java

    Hi,
    I want to display the data in a reprot in graphical form using bar graph.
    Can anybody suggest me of any free third party tools that creates graphs (bar/pie graphs etc).

    Google for: java graph
    Here is one worth looking at:
    http://www.jfree.org/jfreechart/index.php

  • Web Agent Graph propeties

    Hi
    We are using Oracle Express Web Agent.
    In Java graph if we move the cursor on the grapgh it displays the exact measure value for that dimension value where the cursor is left.
    Is it possible to show all the values by default on the graph with out moving the cursor like what we get in a excel sheet graph.

    sorry for the confusion..
    after the mouse has stopped over a bar or line section it displays the value
    i want the values for all the bars to be displayed without even moving the mouse
    is there any such property to arrive at this

  • OLAP JAVA API - JDev

    hi all!
    i want to develop an olap application with JDeveloper and i´ve followed the steps of the tutorials on bibeans tech site (create and format bi objects). Now i´ve got a graph and a crosstab formatted etc. which i can show in JDeveloper.
    My question: is it possible to produce the crosstab and graph with the java graph api on my own or to get the java-code behind the produced crosstab/graph? First of all is there a java code behind?
    I´ve recognized the oracle.dss.* package but i can´t find a api guide or sth. like that on the oracle site...
    Can anyone help me?
    greetz pm

    As far as I know there isn't any detailed guid or help doc. The best you can get is the help doc inside JDeveloper.
    To answer your question, yes its possible to create presentations using java api.
    There are some code fragments inside of the help doc - but its very minimal - you have to find your way through it!!
    For a web app - you could use a combination of bi bean tags (for std. features ) & java API ( for any customaization if neded) .
    EG: Use the presentation tag to build the presentation in a JSP
    And then add some custom java code inside if needed for any customization...
    <%
    Presentation crossTab = (Presentation)pageContext.findAttribute("MyWorkspace_pres1");
    ThinCrosstab thinCrosstab = (ThinCrosstab)crossTab.getView();
    DataDirector dd = thinCrosstab.getModel().getDataDirector();
    DataAccess da = thinCrosstab.getModel().getDataAccess();
    %>
    Good Luck!

  • Resizing a window containing a graph

    I have created a class that plots points on a graph using two arrays passed to the class. One array is for the x-values, the other is for the y-values. Initially, the graph is fine. When I minimize or maximize the window, the values in the arrays change and causes the points to disappear. If I restore the window to the original size, the points are still gone. Why are the values in my array changing? Here is the code:
    //Graph_Lin.java
    //Graphs thermodynamic properties
    import java.util.Scanner;
    import java.awt.Graphics;
    import javax.swing.JPanel;
    public class Graph_Lin extends JPanel
      private int x1, y1, x2, y2;
      public double x[], y[];
      public double xpoint[], ypoint[];
      private double xmax = 0;
      private double ymax = 0;
      private double xmin, ymin, xrange, yrange;
      //constructor sets coordinates of axes
      public Graph_Lin( double xdata[], double ydata[] )
        x = xdata;
        y = ydata;
        xpoint = xdata;
        ypoint = ydata;
          xmin = x[0];
          ymin = y[0];
          int j = 0;
          while ( x[j] > 0)
            if ( x[j] > xmax)
           xmax = x[j];
         if ( y[j] > ymax)
             ymax = y[j];
            if ( x[j] < xmin)
           xmin = x[j];
         if ( y[j] < ymin)
             ymin = y[j];
         j++;
          yrange = ymax - ymin;
          xrange = xmax - xmin;
        public void paintComponent( Graphics g )
          super.paintComponent( g );
          x1 = getx1();
          x2 = getx2();
          y1 = gety1();
          y2 = gety2();
          g.drawLine(x1, y1, x2, y1);
          g.drawLine(x1, y1, x1, y2);
    //*****create the points for plotting*************
          int diam = 10;  //diameter of data point in pixels, should be an even number
          for ( int i = 0; i < x.length; i++ )
         xpoint[i] = (x[i]-xmin)/xrange*(x2-x1)+x1 - diam/2;
         ypoint[i] = y1 - (y[i]-ymin)/yrange*(y1-y2) - diam/2;
          for ( int i = 0; i < x.length; i++ )
           g.drawOval( ((int) xpoint),((int) ypoint[i]),diam,diam);
    //*****get values for the x and y axes****************
    public int getx1()
    return x1 = (int) (.05 * getWidth());
    public int gety1()
    return y1 = (int) (.95 * getHeight());
    public int getx2()
    return x2 = (int) (.95 * getWidth());
    public int gety2()
    return y2 = (int) (.05 * getHeight());
    //*****end get values for the x and y axes************

    What is an SSCCE? Here are the other files. I think I got them all.
    //LiquidDensity.java
    //This class calculates and returns density for water vapor
    //First, it calculates specific volume.  Then it returns the reciprocal as density
    public class LiquidDensity
      public double getv(double T)
          double kv = 1;          //kv represents specific volume x 10^3
          double Th, Tl, kh, kl;     //kh is spec vol at Th, kl is spec vol at Tl
         if (T >= 645 && T <= 647.3)
              Th = 647.3;
              Tl = 645;
                kh = 3.170;
              kl = 2.351;
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 640 && T <= 645)
              Tl = 640;
              Th = Tl+5;
                kl = 2.075;
              kh = 2.351;
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 635 && T <= 640)
              Tl = 635;
              Th = Tl+5;
                kl = 1.935;
              kh = 2.075;
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 630 && T <= 635)
              Tl = 630;     //mod
              Th = Tl+5;
                kl = 1.856;     //mod
              kh = 1.935;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 625 && T <= 630)
              Tl = 625;     //mod
              Th = Tl+5;
                kl = 1.778;     //mod
              kh = 1.856;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 620 && T <= 625)
              Tl = 620;     //mod
              Th = Tl+5;
                kl = 1.705;     //mod
              kh = 1.778;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 610 && T <= 620)
              Tl = 610;     //mod
              Th = Tl+10;
                kl = 1.612;     //mod
              kh = 1.705;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 600 && T <= 610)
              Tl = 600;     //mod
              Th = Tl+10;
                kl = 1.541;     //mod
              kh = 1.612;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 590 && T <= 600)
              Tl = 590;     //mod
              Th = Tl+10;
                kl = 1.482;     //mod
              kh = 1.541;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 580 && T <= 590)
              Tl = 580;     //mod
              Th = Tl+10;
                kl = 1.433;     //mod
              kh = 1.482;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 570 && T <= 580)
              Tl = 570;     //mod
              Th = Tl+10;
                kl = 1.392;     //mod
              kh = 1.433;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 560 && T <= 570)
              Tl = 560;     //mod
              Th = Tl+10;
                kl = 1.355;     //mod
              kh = 1.392;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 550 && T <= 560)
              Tl = 550;     //mod
              Th = Tl+10;
                kl = 1.323;     //mod
              kh = 1.355;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 540 && T <= 550)
              Tl = 540;     //mod
              Th = Tl+10;
                kl = 1.294;     //mod
              kh = 1.323;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 530 && T <= 540)
              Tl = 530;     //mod
              Th = Tl+10;
                kl = 1.268;     //mod
              kh = 1.294;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 520 && T <= 530)
              Tl = 520;     //mod
              Th = Tl+10;
                kl = 1.244;     //mod
              kh = 1.268;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 510 && T <= 520)
              Tl = 510;     //mod
              Th = Tl+10;
                kl = 1.222;     //mod
              kh = 1.244;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 500 && T <= 510)
              Tl = 500;     //mod
              Th = Tl+10;
                kl = 1.203;     //mod
              kh = 1.222;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 490 && T <= 500)
              Tl = 490;     //mod
              Th = Tl+10;
                kl = 1.184;     //mod
              kh = 1.203;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 480 && T <= 490)
              Tl = 480;     //mod
              Th = Tl+10;
                kl = 1.167;     //mod
              kh = 1.184;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 470 && T <= 480)
              Tl = 470;     //mod
              Th = Tl+10;
                kl = 1.152;     //mod
              kh = 1.167;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 460 && T <= 470)
              Tl = 460;     //mod
              Th = Tl+10;
                kl = 1.137;     //mod
              kh = 1.152;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 450 && T <= 460)
              Tl = 450;     //mod
              Th = Tl+10;
                kl = 1.123;     //mod
              kh = 1.137;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 440 && T <= 450)
              Tl = 440;     //mod
              Th = Tl+10;
                kl = 1.110;     //mod
              kh = 1.123;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 430 && T <= 440)
              Tl = 430;     //mod
              Th = Tl+10;
                kl = 1.099;     //mod
              kh = 1.110;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 420 && T <= 430)
              Tl = 420;     //mod
              Th = Tl+10;
                kl = 1.088;     //mod
              kh = 1.099;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 410 && T <= 420)
              Tl = 410;     //mod
              Th = Tl+10;
                kl = 1.077;     //mod
              kh = 1.088;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 400 && T <= 410)
              Tl = 400;     //mod
              Th = Tl+10;
                kl = 1.067;     //mod
              kh = 1.077;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 390 && T <= 400)
              Tl = 390;     //mod
              Th = Tl+10;
                kl = 1.058;     //mod
              kh = 1.067;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 385 && T <= 390)
              Tl = 385;     //mod
              Th = Tl+5;
                kl = 1.053;     //mod
              kh = 1.058;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 380 && T <= 385)
              Tl = 380;     //mod
              Th = Tl+5;
                kl = 1.049;     //mod
              kh = 1.053;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 375 && T <= 380)
              Tl = 375;     //mod
              Th = Tl+5;
                kl = 1.045;     //mod
              kh = 1.049;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 373.15 && T <= 375)
              Tl = 373.15;     //mod
              Th = 375;
                kl = 1.044;     //mod
              kh = 1.045;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         else if (T >= 370 && T <= 373.15)
              Tl = 370;     //mod
              Th = 373.15;
                kl = 1.041;     //mod
              kh = 1.044;     //mod
              kv = (((kh-kl)/(Th-Tl))*(T-Th)+kh)*Math.pow(10, -3);
         return 1/kv;          //returns liquid density for specified temperature
    }Next file
    //A Test program
    //John Abbitt
    //November 29, 2006
    import javax.swing.JFrame;     //import class JOptionPane
    public class Test
      public static void main( String args[] )
        double array1[] = new double[200];
        double array2[] = new double[200];
        LiquidDensity dl = new LiquidDensity();
        //Conductivity c = new Conductivity();
        //SpecificVolumeG g = new SpecificVolumeG();
        double T = 370;
        for (int i = 0; i <56; i++)
          array1[i] = T;
          array2[i] = dl.getv(T)  ;
          T=T+5;
        //Test the graph
        JTabbedPaneSetUp application = new JTabbedPaneSetUp(array1, array2);
        application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        application.setSize( 400, 400 );
        application.setVisible( true );
    }Next file
    //A Test program
    //John Abbitt
    //November 29, 2006
    import javax.swing.*;     //import class JOptionPane
    public class JTabbedPaneSetUp extends JFrame
      public double x[], y[];
      public JTabbedPaneSetUp(double array1[], double array2[])
        super( "Graph Program" );
        x = array1;
        y = array2;
        Graph_Lin graph1 = new Graph_Lin(x, y);
        Graph_Log graph2 = new Graph_Log(x, y);
        JTabbedPane tabbedPane = new JTabbedPane();
        //set up panel1 and add it to JTabbedPane
        JPanel panel1 = new JPanel();
        tabbedPane.addTab( "Linear", null, graph1, "Displays a liner graph");
        //set up panel2 and add it to JTabbedPane
        JPanel panel2 = new JPanel();
        tabbedPane.addTab( "Semi-log", null, graph2, "Displays a semi-log graph");
        add( tabbedPane );
    }

  • 3D Graph Layout Algorithms?

    Hello there! I'm developing a project for my first computer science thesis at the university of Bari, Italy. This project consists in a OpenGL graph visualization tool but I'm having trouble in implementing a correct layout algorithm.
    The problem is that I have been unable to find any information regarding the actual algorithms.. all I've discovered is that there are many commercial products out there that implement these algorithms.. :) I need to know how to implement them myself!
    I have a set of spheres (and the x-y-z coordinates of their center), and a set of edges which describe the various connection between those spheres. I'm currently using a sort of very simple spring embedder algorithm which works in this way:
    Phase 1:
    get sphere 1 (s1)
    get sphere 2 (s2)
    check s1 against all other spheres
    if their euclidean distance is too small they are moved farther away in this way:
    if (s1.x < s2.x)
    s1.x -= delta
    s2.x += delta
    if (s1.y < s2.y)
    s1.y -= delta
    and so on. This is the only way to avoid collisions between spheres that I thought of, since they are not puntiform in fact they have a certain radious. Then in phase 2 I iterate between all the edges and if two connected spheres are too distant from each other they are moved nearer in a way like the one described above. But it doesn't seem to work as it should in fact this algorithm seems to lock the spheres after a number of iteration but rarely produces pleasing visual configurations.
    So could anyone please point me in the right direction? What kind of algorithm could I use? A description would be very useful.. Thanks in advance!

    Hi, I am coauthor and developer of some of the spring-embedder algorithms used in the Java graph layout library 'yFiles' (we call them 'organic layout algorithms'). Some of the algorithms actually work in 3D and all of them can be adapted very easily to run in 3D. We are using combinations and variants and enhanced versions of some of the following algorithms, as well as some of our own, but for a starter this should be enough information for you:
    google for 'GRIP layout' 'GUIDE layout', Kamada-Kawai, Fruchterman-Reingold, Eigenvalue graph layout, GEM spring embedder,
    Implementing those algorithms well can lead to very nice results: feel free to take a look at our gallery of graph layouts:
    http://www.yworks.com/en/products_yfiles_practicalinfo_gallery.htm
    Regards, and a happy new year, Sebastian

  • Superimposing Graphs

    HI, I need to superimpose graphs using one of the free java graph libraries such as JGraph or something. Does anyone know if superimposing graphs with these free libraries is possible? Thanks.

    It doesn't matter whether it is "data points" (I assume you mean from an experiment of some sort) or "equations". To plot an equation, you plug in 'x' values to compute 'y' values. Then you plot those 'x, y' points, which would be equivalent to your experimental data points.
    If nothing else, putting two or more sets of 'x, y' points onto the same chart should be doable if you just plot all the points as though they were one set of points. I imagine if you plot them in order set1, set2, set3, ..., you could draw lines between the points for each set, or make points from each set be a different color, or whatever you need.
    I think you need to do the research, as nicklap suggested. Check the API for whatever graphing library you want to use.

Maybe you are looking for

  • How to set page margins in numbers version 3.0?

    How can I set document margins in Numbers version 3.0 ? In numbers "help" , "margins" has no results. Normally I have a item "page layout" just above "print..."  in the archive tab, but in this version it is missing.

  • Lost files in premiere pro after installing photosop

    hi, I lost all my premiere pro files after installing photoshop. The same happened probably 3 months ago when I switched from full package subscription to just one program. Any help with that? is there a way to get my files back? I didnt backup my co

  • Remove underscore from buttons, add Alt text

    Hi, Thanks in advance for your help. I am having more problems with the RH's Govt template. The forward and back buttons would not appear, so I have created my own buttons and incorporated into my user guide. However, there is an underscore appearing

  • New HD Video + "old" Quicktime Movies

    I want to purchase an HD camcorder. Vixia HF M30. I have existing Quicktime movies saved as standard video - and will make more standard videos in software named Anime Studio. Can I edit (combine) HD video and standard video in a iMovie project? Can

  • Retrieving lost data

    Hi,      i recently upgraded to the iphone 5s, i plugged it in to my mac for the first time today. Only for it to restore to my old iphones back-up, deleting the photos etc i had already taken on the 5s to date. I do not have my photo stream on, or i