Label x,y coordinate on plot DIAdem

How do I select and label the x,y coordinate for a min/max point in DIAdem (version 11.0) in the VIEW tab? Is it possible to select a point and have the coordinate automatically labele the (x,y) values? (What if it isn't a specific max or min point?)

Hi, 
Labeling is best done in the Report panel instead of the View Panel.  Here is a link with information on how to do this. My recommendation for working in the View panel is you could have a Textbox section with a function in the @@   @@ format, such as @@CMax("Channel")@@, but this would not achieve quite the results you are looking for.
Cheers,
Kelly R.
Applications Engineer
National Instruments

Similar Messages

  • Label each point in scatter plot

    Hi There,
    I am plotting a set of data (in x,y format) on a scatter plot. Is there a way in labview such that when i move mouse over some dot it can tell me information about that dot (like the name of that set).
    Thanks in advance
    Yogesh 
    PS: i am using Labview 8.2 
    Solved!
    Go to Solution.

    The reason why it hangs is because you have 2 event structures inside a loop. You should only have one event structure in a loop. This is documented in the LabVIEW Help. With 2 event structures one of them will block the other.
    Your code is also about 3 times larger than it needs to be:
    To create the array of names for the dropdowns you only need to autoindex a for-loop from the 2D array of data and use the Format Into String function.  You don't actually need to use the values - you only need to autoindex the for-loop.
    Using Delete From Array and Reshape Array just to pull out a row is simply silly (not to mention a Rube Goldberg). That's what Index Array is for.
    In the Cursor Move event case you only need one function: Index Array. The point index is already available to you from the event case's data.
    Half of the code really belongs outside of the while loop since none of that data ever changes, so what's the point of regenerating it each time?
    Instead of using 2 Index Array functions just to get the list of names, wire a True to the Read From Spreadsheet File's transpose? input and use the first row output.
    I've attached a simplified version of your VI.
    Attachments:
    PCoption2_MOD.vi ‏34 KB

  • Line chart x-axis label overloaded with labels

    Hi,
    I have a Line chart filled by a large resultset (hundreds of rows). Each row contains a decimal value and a timestamp. The interval between timestamps is short so it is impossible to plot every single date/time in the x-axis label because there is no space.
    I would like to hide the the x-axis label for most rows and plot this label for each x rows. Something like this:
      18/12/2009 09:00            18/12/2009 10:00           18/12/2009 11:00            18/12/2009 12:00
            |---------------------------|---------------------------|---------------------------|
    In the previous x-axis example there are many timestamps between 18/12/2009 09:00 and 18/12/2009 10:00 but they are not plotted in the chart. It is possible to do something like this in MII charts?
    Thank you,
    Wilson Freitas
    Vetta Technologies

    Hi,
    I think Michael is right about the Ticks per label parameter. Looks like it is not working for me because the chart data binding is not behaving as expected.
    The chart rowset is composed by two fields: decimal and date time. The date time field is already converted to string. The rowset comes from a BLS transaction.
    I think this forum has no support for file upload so I will add links to the xMII workbench screenshots so you guys can see my chart/query configuration.
    This is the XACUTE Query used by the chart: http://www.vetta-group.com:8080/imgs/xacute_config.PNG
    This is the Line Chart configuration:
      - Chart area:http://www.vetta-group.com:8080/imgs/chart_area.PNG
      - Data mapping: http://www.vetta-group.com:8080/imgs/data_mapping.PNG
      - X-axis: http://www.vetta-group.com:8080/imgs/xaxis.PNG
      - Y-axis: http://www.vetta-group.com:8080/imgs/yaxis.PNG
      - Server scaling:http://www.vetta-group.com:8080/imgs/server_scaling.PNG
      - Data series:http://www.vetta-group.com:8080/imgs/data_series.PNG
    The chart row set is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Rowsets DateCreated="2010-02-02T20:50:08" EndDate="2010-02-02T20:50:07"
         StartDate="2010-02-02T19:50:07" Version="12.0.8 Build(24)">
         <Rowset>
              <Columns>
                   <Column Description="" MaxRange="1" MinRange="0" Name="TAG_TIMESTAMP"
                        SQLDataType="1" SourceColumn="TAG_TIMESTAMP" />
                   <Column Description="" MaxRange="1" MinRange="0" Name="TAG_VALUE"
                        SQLDataType="8" SourceColumn="TAG_VALUE" />
              </Columns>
              <Row>
                   <TAG_TIMESTAMP>01/12/2009 12:00:00</TAG_TIMESTAMP>
                   <TAG_VALUE>80.723414730584</TAG_VALUE>
              </Row>
              <Row>
                   <TAG_TIMESTAMP>01/12/2009 12:23:59</TAG_TIMESTAMP>
                   <TAG_VALUE>87.33149769706</TAG_VALUE>
              </Row>
              <Row>
                   <TAG_TIMESTAMP>02/12/2009 12:47:59</TAG_TIMESTAMP>
                   <TAG_VALUE>86.966843701221</TAG_VALUE>
              </Row>
              <Row>
                   <TAG_TIMESTAMP>02/12/2009 01:11:59</TAG_TIMESTAMP>
                   <TAG_VALUE>83.989991258174</TAG_VALUE>
              </Row>
         </Rowset>
    </Rowsets>
    When I run the chart I get this result: http://www.vetta-group.com:8080/imgs/chart1.PNG
    As you can see the chart has no X-Axis labels ans I need to add the date/time to the X-axis. If I add the field to "X-Axis label columns" the field values are ploted but the parameter "Ticks per label" is ignored and hundreds of labels are ploted together and is impossible to read them. I think the "Ticks per label" parameter only works for fields added to Labels columns (in data mapping). The problem I am facing is: when I add the date field (http://www.vetta-group.com:8080/imgs/data_mapping2.PNG) to Label columns I get an empty chart like this: http://www.vetta-group.com:8080/imgs/chart2.PNG
    What am I doing wrong?
    Thank you

  • Plotting Senderbase Information on a World Map

    Greetings,
    I have whipped up a quick script some of you may find useful.
    ip2mapplot.py is a Python script for resolving a number of IP addresses to latitude / longitude coordinates and plotting them on a world map
    Below is an image generated from one days worth of Senderbase drops on our Ironport MGAs:
    [img:f531ef1b7c]http://insecure.io/images/a/a6/Map_sbrs_small.jpg[/img:f531ef1b7c]
    Source code is available here: http://research.mince.ac.nz/ip2mapplot.py
    Further instructions here: http://insecure.io/index.php/Code/ip2mapplot
    Cheers,
    si

    Here's what our map looks like with one week's worth of data on hosts with a SBRS of -10 to -4.
    [img:c91b0e4b2a]http://web.acd.ccac.edu/~bpoyner/ironport/ironport-map-small.jpg[/img:c91b0e4b2a]
    [+] Found 691344 unique IP addresses
    [+] Determining unique latitude / longitude points
    [+] Plotting 15037 discrete points on map
    [-] Plotting 14098 points for x < 100
    [-] Plotting 772 points for 100 < x < 500
    [-] Plotting 131 points for 500 < x <2500> 2500
    I don't know if anybody else ran into this issue, but as-is the script provided by si doesn't work with python 2.3. You'll get the following error message:
    [+] Determining unique latitude / longitude points
    Traceback (most recent call last):
    File "./ip2mapplot.py", line 41, in ?
    latlon = count.partition(',')
    AttributeError: 'str' object has no attribute 'partition'
    You have to change partition to split, and change the latlon array reference accordingly.

  • Overlapping labels in Scatter Graph - Web Dynpro for Java

    Hi
    We have created a Scatter Graph in Web Dynpro for Java.
    The xValue and yValue are obtained from a node. We are showing a name as the label on each point so plotted on the graph through Chart Designer (Format->$Label).
    The issue we are facing is:
    We have 3 points with the same xValue and yValue. Meaning they plot the same point on the graph. But the name associated with each is different. These names are overlapping (as its the same point on the graph) and are hence not readable.
    Is there any way in which we can show multiple names/labels on the same point in a readable way?
    Is it possible for us to show a tool tip at each point where the tool tip contains the comma seperated names/labels associated with all the x and yValues at that point?

    Hi,
    there's no automatic mechanism for detecting such label collisions in the scatter chart. However, you can change the position of each label (HorizontalPosition, VerticalPosition) and use point customizing to position several labels around this single point.
    Regards, Kai

  • Obscured Labels - Graphs and tab controls

    In LV 2012 new options (Preferences or Options on the Mac) allow placing labels on new controls and indicators in various positions. I have noticed that for graphs and tab controls some of the options result in obscured labels.  See the image below.
    The preferences are set as shown:
    When a graph is dropped, the label is superimposed on the plot legend display.
    For a tab control everything is OK until enough tabs are added to create a second row. Those tabs are behind the label.  I can understand some reluctance to move a label automatically after it has been created (in the tab case), but I think it would be better moved up than obscured.  Perhaps if the programmmer had repositioned the label before the tabs were added, then it should not move automatically.
    Is this a bug?
    Lynn

    Hi Lynn,
    I've played around with these settings and I get the same results.  It seems with the tab control that the new row of labels is pushed to the top by default, and the label will be obscured unless it has been placed to the bottom or side of the control.  After looking into things further it seems that this is the expected behavior rather than a bug.  You're welcome to post your idea to the Idea Exchange as a feature request, it seems like that might be a better way to handle the label positioning in the future.
    Matt Lee
    National Instruments
    Applications Engineer

  • View coordinate​s window is off-screen

    I have an unconventional dual-monitor setup while my laptop is docked. It's resulted in the coordinates window being located far off-screen. I've moved the secondary monitor around the desktop area to try and locate the window to move it back within view, but have not had success. I've undocked to try and locate the window but have not been successful. I've reset DIadem but this has not brought the window back in view. DIadem isn't very handy for my use without that window.
    Solved!
    Go to Solution.

    The first solution in the link goes through how to locate a window that is registered as a window with windows explorer, thus giving it a bar on the taskbar. Unfortunately the coordinate window isn't, so I can't locate it with the "move" action.
    On the second solution, I should have been specific that I'm using windows XP, and a corporate image at that. I don't find appdata in my user folder (for XP that's C:\Documents and Settings\User\.appdata\). Where's the config file in XP?
    EDIT: I actually just tried to use only the keyboard shortcuts immediately after enabling the coordinate window. DIadem's main window loses focus, so I figured perhaps the coordinate window is given focus. So, I hit Alt+space and the dialog box appears on my screen nearest to the location of the coordinate window. From there I can select "move" with the mouse and by moving the mouse after that, the coordinate window appears underneath it. Fixed!
    Howtogeek:
    Note: For keyboard savvy people, you can just alt-tab to the window, use Alt+Space, then M, then Arrow key, and then move your mouse.

  • Updating coordinates

    A sensor node while moving , sends it coordinates to a mysql db.
    A java applet must extract these coordinates and plot its trajectory in real time. I have done this so far. But I also want to put a small oval to show where the node is right now, not just the path it has covered.
    For this, I could put a small oval at the position indicated by the latest row of the db. But when the db gets updated, the oval gets drawn at a new position but the previous oval is still there. I hope I have made my problem clear. Please help.

    thanks for the suggestion. This is the basic structure of my code :
    public void paint(Graphics g) {
    // This part draws the coordinate axes etc. and also the points already in the mysql db.
    public void paintupdate(Graphics g) {
    //This method keeps checking the last line of the db. If there is a change, it draws the a line from the last position to the new position.In the update method, I call the paintupdate method.
    Now, as you have suggested, if i clear the drawing area, won;t it also erase the lines. I only want to erase the small oval which represents the node.

  • How to change the text in the legend of a graph programmat​ically in labview

    I have many graphs in one plot and want to show the legend the name of the graph (i.e. the filename). How do I change the text in the legend programmatically?

    Create a property node for your graph. Use the property node "Active Plot" to define which plot (or line) you want to rename. Then write the new legend label to the property node "Plot.Name". See attached.
    Tim
    Attachments:
    legend.vi ‏12 KB

  • Convert applet to swing

    Hi;
    Could anyone help me to convert my example code from applet to swing,please, thank
    import java.awt.*;
    import java.applet.*;
    import java.lang.Math;
    import java.awt.Font;
    import java.lang.Integer;
    /*** Main class == Applet  ***/
    public class Suffix extends Applet implements Runnable {
       private Thread main;
       public s_tree _tree=null;
       public node nd=null;
       public boolean userPause=false,resumed=false;
       private String str[]={"GOOGOL$","Paused","Resumed","Compacting","Done"};
       public Color bl=Color.blue,rd=Color.red;
       public Font fnt;
       public int mode=3,delay=3000;
       private char alph[]={'$','Q','W','E','R','T','Y','U','I','O',
                        'P','A','S','D','F','G','H','J','K','L',
                        'Z','X','C','V','B','N','M'};
    /*** initialisation function. It is the first Funct to be called ***/
       public void init() {
    // Temp data
          int temp=0,nxx=30;
    // Ini. of fnt , the font size + style used by this applet.
          fnt=new Font("Denis",1,25);
    /*** parsing command parameters ***/
    //      try {
    //DELAY VALUE PARAM
             String param=getParameter("DELAY");
             if (param!=null) {
                temp=Integer.parseInt(param);
                if ((temp>500)&&(temp<6000)) delay=temp;
    //x LEFTMOST coordinate
             param=getParameter("X");
             if (param!=null) {
                temp=Integer.parseInt(param);
                nxx=temp;
    //Base String parameter
             param=getParameter("STRING");
             if ((param!=null)&&(param.length()<15)) {
                str[0]=param;
    //      } catch (ParseException e) { showParseError(e); }
    // Allocating mem for _tree + initialize it .
          _tree=new s_tree(str[0],fnt);
    // Override xx (left_bound) by the caller's or the default value
          _tree.xx=nxx;
    /*** "animation loop is controled here" ***/
       public void run() {
         while(true) {
             try {
    //delay the process for time==delay
                Thread.sleep(delay);
             } catch (InterruptedException e) {}
    //controls animation loop
          repaint();
    /*** override APPLET's paint function ***/
       public void paint (Graphics g) {
    //Output graphics
          update(g);
    /*** Updates the graphics ***/
       public void update (Graphics g) {
    // Set font
          if (g.getFont()!=fnt) g.setFont(fnt);
          if ((userPause==false)&&(resumed==false)) // Is the applet paused ?
             g.clearRect(0,0,1024,768); //clears the screen
             if (_tree==null) {     // if tree is not initialised
                init();
                //_tree.show(g);
             } else {
                if (mode==3) {      // if graphics output mode is 3
                   if (nd!=null) nd._to_rd(false);
                   nd=_tree.step_compact(nd);  //compacts the tree one step further
                   if (nd==null)  // if tree is totally compacted ...
                      mode=4;   //change the ani. mode to 4 (don't call compact)
                   else
                      nd._to_rd(true);  //colors the next node to compact in red
    // Draw the "titleviewport's" comment
             g.setColor(bl);
             g.drawString(str[mode],10,15);
             _tree.show(g);     //show tree
          } else {
             g.clearRect(0,0,200,25);  //clears the "titleviewport to update it"
             g.setColor(rd);
             if (resumed==true){
                resumed=false;
                g.drawString(str[2],10,15);
             else g.drawString(str[1],10,15);
    /*** restart the animation process ***/
       public void start() {
          main=new Thread(this);
          main.start();
    /*** stops the animation ***/
       public void stop() {
          main.stop();
          main=null;
    /*** Handles the user's events (mouse , kbd , ... ***/
       public boolean handleEvent(Event evt) {
          if (evt.id==Event.MOUSE_DOWN) { //if mouse button have been pushed ...
                if (main!=null && main.isAlive()) {
                   if (userPause) {
                      main.start();
                      resumed=true;
                   } else {
                      main.stop();
                   userPause= !userPause;
                } else {
                   main= new Thread(this);
                   main.start();
                   userPause=false;
                   resumed=true;
                repaint();
             return true;
          } else {
             return super.handleEvent(evt);
    /*** Linked List of node(s) ***/
    class nodelist{
       nodelist next=null;
       node ptr=null;
       public void nodelist(){};
    /*** node of a structure tree ***/
    class node {
    // Relatives
       public nodelist children=null;
       public node parent=null;
    // variables
       public int maxchild=12,childnum=0,level=0;
       public int center[]={0,0};
       public int xlen=20,ylen=10,vspace=15,hspace=8;
       public int x[]={0,0};
       public boolean _ishidden=false;
       private Color bk=Color.black,wh=Color.white,rd=Color.red;
    // Node==red toggle variable
       public boolean to_rd=false;
    // node's text
       public String label=null;
    /*** initialisation of the node ***/
       public node(int nx,int ny,int nxl,int nyl,node nparent,int nlevel,String nstr){
          x[0]=nx; x[1]=ny;
          xlen=nxl; ylen=nyl;
          parent=nparent;
          level=nlevel;
          label=new String(nstr);
          children=new nodelist();
    /*** destroys the node ***/
       public void destruct() {
    // NOTE : not like C++ destructors . Do not confuse .
          delete_subtree();
          children=null;
          parent=null;
          bk=wh=rd=null;
          label=null;
    /*** Node to red toggle switch ***/
       public void _to_rd(boolean b) {to_rd=b;};
    /*** Adds a child to this node ***/
       public void add_child(int nx,int ny,int nxl,int nyl,node nparent,int nlevel,
                                String nstr) {
          if (childnum<maxchild) {    // if 'legal' space left ...
             if (children==null) {    // if no nodelist attached ...
                children=new nodelist(); //init. children
                children.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr); //create node
                childnum++;
             } else {
                nodelist dummy=children;
    // search for the last nodelist
                while (dummy.next!=null) dummy=dummy.next;
                dummy.next=new nodelist(); //adds a nodelist
                dummy=dummy.next;
                dummy.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr); //create child
                childnum++;
    // Tree needs to be realigned
    /*** adds a child and returns its address ***/
       public node add_child_ret(int nx,int ny,int nxl,int nyl,node nparent,int nlevel,
                                String nstr) {
          if (childnum<maxchild) {
             if (children==null) {
                children=new nodelist();
                children.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr);
                childnum++;
                return(children.ptr);
             } else {
                nodelist dummy=children;
    // search for the last child
                while (dummy.next!=null) dummy=dummy.next;
                dummy.next=new nodelist();
                dummy=dummy.next;
                dummy.ptr=new node(nx,ny,nxl,nyl,nparent,nlevel,nstr);
                childnum++;
                return(dummy.ptr);
        return(null);
    // Tree needs to be realigned
    /*** adds the node nchild as a new children ***/
       public void add_child(node nchild) {
          nodelist dummy=null;
          dummy=children;
          if (childnum<maxchild) {
             if (children==null) {
                children=new nodelist();
                children.ptr=nchild;
                childnum++;
             } else {
                while (dummy.next!=null) dummy=dummy.next;
                dummy.next=new nodelist();
                dummy=dummy.next;
                dummy.ptr=nchild;
                childnum++;
    //Tree needs to restructured.
    /*** deletes all childrens ***/
       public void delete_subtree() {
          while (childnum>0 && children!=null) { //while child exists , kill it
             if (children.ptr!=null) {
                children.ptr.destruct();
                children.ptr=null;
                children=children.next;
             } else children=null;
             childnum--;
    /*** moves this node and its children horizontally ***/
       public void move_tree(int nx) {
          nodelist dummy=children;
          x[0]+=nx;
          while (childnum>0 && dummy!=null) {
             if (dummy.ptr!=null) {
                dummy.ptr.move_tree(nx);
                dummy=dummy.next;
    /*** removes the node from the tree (do not preserve order of ordered tree ) ***/
       public void remove_node() {
          nodelist dummy=children;
          while(dummy!=null) {
             if (dummy.ptr!=null){
                parent.add_child(dummy.ptr);
             dummy=dummy.next;
          children=null;
    //could call restructure tree here .
    //don't forget to change the node's levels !!!
    /*** show all nodes ***/
       public void show_all(Graphics g) {
          if (_ishidden==false) { //if not hidden
             if (children!=null) {  //if child exist
                nodelist dummy=children; //temp var.
                while(dummy!=null) { //while there is a child...
                   if (dummy.ptr!=null)
                      dummy.ptr.show_all(g);
                   dummy=dummy.next;
             show_node(g);
    /*** show nodes in preorder ***/
       public int preorder_show(Graphics g,int label){
          if (_ishidden==false) {
             show_node(g/*,label++*/);
             if (children!=null) {
                nodelist dummy=children;
                while(dummy!=null) {
                   if (dummy.ptr!=null) label=dummy.ptr.preorder_show(g,label);
                   dummy=dummy.next;
          return(label);
    /** show nodes in postorder ***/
       public int postorder_show(Graphics g,int label){
          if (_ishidden==false) {
             if (children!=null) {
                nodelist dummy=children;
                while(dummy!=null) {
                   if (dummy.ptr!=null) label=dummy.ptr.postorder_show(g,label);
                   dummy=dummy.next;
             show_node(g/*,label++*/);
          return(label);
    /*** show nodes in inorder ***/
       public int inorder_show(Graphics g,int label){
          if (_ishidden==false) {
             if (children!=null) {
                nodelist dummy=children;
                if (dummy.ptr!=null) label=dummy.ptr.inorder_show(g,label);
                dummy=dummy.next;
                show_node(g/*,label++*/);
                while(dummy!=null) {
                   if (dummy.ptr!=null) label=dummy.ptr.inorder_show(g,label);
                   dummy=dummy.next;
             } else show_node(g/*,label++*/);
          return(label);
    /*** Restructure the coordinates of all nodes ***/
       public int align(int min,Font fnt,int lev,Graphics g){
          int i=min; //left bound
          FontMetrics fntm=g.getFontMetrics(fnt); //used to know the text size
          level=lev;
    // node x and y radius are computed here
          xlen=4+(int)(fntm.stringWidth(label)/2);
          ylen=4+(int)(fntm.getHeight()/2);
          if (children!=null) {      //if child present ...
             nodelist dummy=children;
             while(dummy!=null) {
                if (dummy.ptr!=null) i=dummy.ptr.align(i,fnt,lev+1,g); //align them
                   dummy=dummy.next;
          x[0]=min+(int)((i-min)/2); //could be underflow so will be checked
          x[1]=lev*(vspace+(ylen*2))+26;
    // overflow should happen only when the parent node is larger than its children
          if ((x[0]-xlen)<min) { //check uf underflow occurs.
             move_tree(min+xlen-x[0]+1);
             i=x[0]+xlen+5;
          if (childnum==0) x[0]+=2;
        return(i);
    /*** returns the child following nd ***/
    /*** if nd==null -> return 1st child ***/
    /***  if nd==last children -> return null***/
       public node next_child(node nd) {
          nodelist dummy=null;
          if (children==null) return(null);
          if (nd==null) return(children.ptr);
          dummy=children;
          while (dummy.ptr!=nd) {
             if (dummy.next!=null)
                dummy=dummy.next;
             else
                return(null);
          dummy=dummy.next;
          if (dummy!=null) return(dummy.ptr);
             else return(null);
    /*** returns child with first letter==nh ***/
       public node get_childd(char ch) {
          nodelist dummy=null;
          dummy=children;
          while (dummy!=null) {
             if (dummy.ptr!=null) {
                if (dummy.ptr.label.charAt(0)==ch)
                   return(dummy.ptr);
             dummy=dummy.next;
        return(null);
    /*** returns the nodelist containing nd ***/
       public nodelist get_child(node nd) {
          nodelist dummy=children;
          while (dummy!=null) {
             if (dummy.ptr==nd) return(dummy);
             dummy=dummy.next;
        return(null);
    /*** outputs the node to Screen ***/
       public void show_node(Graphics g) {
          if (_ishidden==false) {
             if (level>0) {  //if it is not a root then draw link-line
                g.setColor(bk);
                g.drawLine(x[0],x[1]-ylen,parent.x[0],parent.x[1]+parent.ylen); //from this node to parent node
             if (to_rd==false)
                g.setColor(wh);
             else
                g.setColor(rd);
             g.fillOval(x[0]-xlen,x[1]-ylen,xlen*2,ylen*2); //draws an oval
             g.setColor(bk);
             g.drawString(label,x[0]-xlen+4,x[1]+ylen-12);  //output the text
    /*** class which uses nodes to create a SUFFIX TREE ***/
    class s_tree {
       node root=null;    // root node.
       String str=null;   // 'search' string
       Font fnt=null;     // font type
       int xx=30;         // left limit for graphics
    /*** initialize a SUFFIX TREE with string==nstr and Font==nfnt ***/
       public s_tree(String nstr,Font nfnt) {
          str=new String(nstr);
          fnt=nfnt;
          create();
    /*** uninitialize the structure **/
       public void destruct() {
          root.destruct();
          str=null;
          fnt=null;
    /*** show the tree ***/
       public void show(Graphics g) {
          root.align(xx,fnt,0,g);   // restructure node's coordinates
          root.show_all(g); //show tree
    /*** creates a tree structure from String=str ***/
       public void create() {
          node dummy=null;
          root=new node(0,0,0,0,dummy,0," "); //create root
          root.parent=null; //just to make sure ...
          for (int i=0;i<str.length();i++) {
    // Create subtree of root in the following way :
    //    create subtree ("ASDF$");
    //        "     "    ("aSDF$");
    //       "    "      ("asDF$"); ...
    // where : the UPPERCASE letters is the part of the string sent to insert_string
             insert_string(str.substring(i));
          //root.align(0,fnt,0); //align root now ?
    /*** creates a subtree of ROOT with String=nstr ***/
       public void insert_string(String nstr) {
          node dummy2=null,dummy=null;
          int i=0;
          dummy=root;
          dummy2=root;
    // As long as a children of dummy2 have the letter nstr[i] , dummy==thischildren
    // It is used to make sure that a node does not have two children with the
    // same letter
          while (dummy2!=null) {
             dummy2=dummy2.get_childd(nstr.charAt(i));
             if (dummy2!=null) {
                i++;
                dummy=dummy2;
    //create the nodes for the rest of the string
          for(;i<nstr.length();i++) {
             if (dummy!=null) dummy=dummy.add_child_ret(0,0,0,0,dummy,1,nstr.substring(i,i+1));
    // Compacts the tree node by node and returns the next node to compact
    // if node==null , compacts the first node ...
    //Works in POST-ORDER
       public node step_compact(node nd) {
          node dummy=nd,dummy2=null;
          nodelist ndlst=null;
    // GOES TO THE LOWER LEFT CHILDREN
          if (nd==null) { //first call !
             dummy=root;
             while(dummy.children!=null) {
                if (dummy.children.ptr==null)
                   dummy.children=dummy.children.next;
                else
                   dummy=dummy.children.ptr;
    //*** tries to find a 'compactable' node ***
    //*** It uses the POST-ORDER method      ***
    // if this node is not the last children then try to find next compactable node
    // in the next children.
          if (dummy.parent.childnum!=1) dummy=next_chain(dummy);
          if (dummy==null) return(null); //fully optimized
    //remove parent node.
    /*** THIS IS WHERE COMPACTING TAKES PLACE  **/
          dummy2=dummy.parent.parent;
          ndlst=dummy2.get_child(dummy.parent);
          if (ndlst==null) return(null); //we've got a beeeeg problem if this happens ...
    //*** merges the parent string with this one and delete parent .
          dummy.label=dummy.parent.label.concat(dummy.label);
          ndlst.ptr=dummy;
          //delete parent .
          dummy.parent=null;
          dummy.parent=dummy2;
    //      root.align(0,fnt,0);
        return(dummy);
    /*** finds the next chain in the tree (i.e. the next compactable node) ***/
       public node next_chain(node nd){
          node dummy=null;
          if (nd.parent==null) return(null); //finished ! This is the root
          if (nd.parent.childnum==1) return(nd); //can be optimized
    // finds the nd.parent's child following nd
          dummy=nd.parent.next_child(nd);
          if (dummy==null)  // if OLD_nd==last child
             return(next_chain(nd.parent));      //tries to find a chain upwards
          else {
                 // OLD_nd was not the last child . nd==OLD_nd's next brother
    // GOES TO THE LOWER LEFT most child of nd's subtree.
             while(dummy.children!=null) {
                if (dummy.children.ptr==null)
                   dummy.children=dummy.children.next;
                else
                   dummy=dummy.children.ptr;
             return(next_chain(dummy)); // returns the next compactable node
    };

    First, show me the rupees! Show me the rupees!

  • Queue problems!

    MAIN QUESTION IS:
    WHEN INSERTING AN ITEM INTO A QUEUE IT OVERWRITES THE PREVIOUS ITEMS WITH THE NEW ITEM, PLUS IT ADDS THAT ITEM AS WELL. SO IF THE QUEUE ORIGINALLY HAD 'N' ITEMS, WHEN YOU ADD A NEW ITEM YOU GET N+1 OF THAT NEW ITEM.
    SEE BELOW FOR MORE EXPLANATION. ALTHOUGH IT LOOKS LONG IT IS EAAAAAAASY TO TRACE!
    Hi,
    I am implementing a queue using class LinkedList. The queue has objects of type 'ItemType' which is a user-defined type. ItemType is a coordinate with x & y values.
    public class Queue {
        LinkedList queueList;
        ItemType item = new ItemType();
        int size;
        /** Creates a new instance of Queue */
        public Queue() {
            queueList = new LinkedList();
            size = queueList.size();
        public void enqueue(ItemType newItem){
            System.out.println("Queue is being accessed for enqueue");
            print();
            System.out.println("Queue size before adding is: "+queueList.size());       
                    size = queueList.size();       
            if(size>0){
                 queueList.add(size,newItem);
            else{
                 queueList.add(0,newItem);
            System.out.print("Item added to the queue: ");
            newItem.print();
            System.out.println("Queue size after adding is: "+queueList.size());   
            print();
        public ItemType dequeue(){
            System.out.println("Queue is being accessed for dequeue");
            System.out.println("Queue size before removing is: "+queueList.size());
            ItemType item = (ItemType) queueList.remove();
            System.out.print("Item removed from the queue: ");
            item.print();
            System.out.println("Queue size after removing is: "+queueList.size());        
            return item;
        public boolean isEmpty()
            System.out.println("Queue is being accessed for isEmpty");
            if (queueList.isEmpty())
                return true;
            else
                return false;
        public void print(){
            System.out.println("Queue is being accessed for print");
            ItemType item;
            ListIterator iterator = queueList.listIterator(0);
            int counter = queueList.size();
            int index = 0;
            System.out.println("Queue size is: "+counter);
            System.out.println("Queue is currently : ");
            while(iterator.hasNext()){
                item = (ItemType) iterator.next();
                item.print();
    }//end of class Queue In my application, I am using a queue in which I enqueue to it and dequeue from it in certain steps. When I run the following code 'this is an excerpt only', the results are reasonable.
      ItemType aa = new ItemType();     
            ItemType bb = new ItemType();
            ItemType cc = new ItemType();
            ItemType dd = new ItemType();  
            ItemType ee = new ItemType(); 
            ItemType ff = new ItemType(); 
            bb.setX(1);
            bb.setY(1);
            dd.setX(2);
            dd.setY(2);
            ee.setX(3);
            ee.setY(3);
            ff.setX(4);
            ff.setY(4);       
            System.out.println("a is");
            aa.print();   
            System.out.println("b is");
            bb.print();
            System.out.println("d is");
            dd.print();       
            System.out.println("e is");
            ee.print();    
            System.out.println("f is");
            ff.print();            
            Q.enqueue(ff);
            Q.enqueue(aa);
            Q.enqueue(bb);
            Q.enqueue(ee);
            Q.enqueue(dd);       
            Q.print();
            cc=Q.dequeue();
            System.out.print("a is");
            cc.print();
            Q.print();
            cc=Q.dequeue();
            System.out.print("b is");
            cc.print();
            Q.print();
            cc=Q.dequeue();
            System.out.print("d is");
            cc.print();
            Q.print();
            cc=Q.dequeue();
            System.out.print("e is");
            cc.print();
            Q.print();
            cc=Q.dequeue();
            System.out.print("f is");
            cc.print();       
            Q.print();I get the following output (its quite simple, I am basically checking if the queue is working properly FIFO):
    a is
    (0,0)
    b is
    (1,1)
    d is
    (2,2)
    e is
    (3,3)
    f is
    (4,4)
    Queue is being accessed for enqueue
    Queue is being accessed for print
    Queue size is: 0
    Queue is currently :
    Queue size before adding is: 0
    Item added to the queue: (4,4)
    Queue size after adding is: 1
    Queue is being accessed for print
    Queue size is: 1
    Queue is currently :
    (4,4)
    Queue is being accessed for enqueue
    Queue is being accessed for print
    Queue size is: 1
    Queue is currently :
    (4,4)
    Queue size before adding is: 1
    Item added to the queue: (0,0)
    Queue size after adding is: 2
    Queue is being accessed for print
    Queue size is: 2
    Queue is currently :
    (4,4)
    (0,0)
    Queue is being accessed for enqueue
    Queue is being accessed for print
    Queue size is: 2
    Queue is currently :
    (4,4)
    (0,0)
    Queue size before adding is: 2
    Item added to the queue: (1,1)
    Queue size after adding is: 3
    Queue is being accessed for print
    Queue size is: 3
    Queue is currently :
    (4,4)
    (0,0)
    (1,1)
    Queue is being accessed for enqueue
    Queue is being accessed for print
    Queue size is: 3
    Queue is currently :
    (4,4)
    (0,0)
    (1,1)
    Queue size before adding is: 3
    Item added to the queue: (3,3)
    Queue size after adding is: 4
    Queue is being accessed for print
    Queue size is: 4
    Queue is currently :
    (4,4)
    (0,0)
    (1,1)
    (3,3)
    Queue is being accessed for enqueue
    Queue is being accessed for print
    Queue size is: 4
    Queue is currently :
    (4,4)
    (0,0)
    (1,1)
    (3,3)
    Queue size before adding is: 4
    Item added to the queue: (2,2)
    Queue size after adding is: 5
    Queue is being accessed for print
    Queue size is: 5
    Queue is currently :
    (4,4)
    (0,0)
    (1,1)
    (3,3)
    (2,2)
    Queue is being accessed for print
    Queue size is: 5
    Queue is currently :
    (4,4)
    (0,0)
    (1,1)
    (3,3)
    (2,2)
    Queue is being accessed for dequeue
    Queue size before removing is: 5
    Item removed from the queue: (4,4)
    Queue size after removing is: 4
    a is(4,4)
    Queue is being accessed for print
    Queue size is: 4
    Queue is currently :
    (0,0)
    (1,1)
    (3,3)
    (2,2)
    Queue is being accessed for dequeue
    Queue size before removing is: 4
    Item removed from the queue: (0,0)
    Queue size after removing is: 3
    b is(0,0)
    Queue is being accessed for print
    Queue size is: 3
    Queue is currently :
    (1,1)
    (3,3)
    (2,2)
    Queue is being accessed for dequeue
    Queue size before removing is: 3
    Item removed from the queue: (1,1)
    Queue size after removing is: 2
    d is(1,1)
    Queue is being accessed for print
    Queue size is: 2
    Queue is currently :
    (3,3)
    (2,2)
    Queue is being accessed for dequeue
    Queue size before removing is: 2
    Item removed from the queue: (3,3)
    Queue size after removing is: 1
    e is(3,3)
    Queue is being accessed for print
    Queue size is: 1
    Queue is currently :
    (2,2)
    Queue is being accessed for dequeue
    Queue size before removing is: 1
    Item removed from the queue: (2,2)
    Queue size after removing is: 0
    f is(2,2)
    Queue is being accessed for print
    Queue size is: 0
    Queue is currently :
    However, when I use the queue in a different application, I get strange results.
    If the queue has currently for example (1,1) and I want to add (2,2), instead of the queue currently being (1,1) (2,2), it is displayed as (2,2) (2,2). The original item is replaced by the new item (for as many times as the new size of the queue)??
    The code is basically doing the following. Dequeuing coordinates from a queue. For each coordinate it labels the neighboring coordinates (up, down, left, right) and enqueues them into the queue. Then it takes the next coordinate in the queue and does the same, and so on....
    The code is quite long but it's fairly basic. There's a lot of auditing in there:
       public void labelGrid(){
    //*                    LABELLING GRID & GETTING NEIGHBOURS OF SQUARE                        *
    queue.enqueue(a) ;     //Insert the starting point into the queue
    x=a.getX();
    y=a.getY();
    grid[x][y].setMark(1);
    while(!queue.isEmpty () && found == 0)
           if(queue.isEmpty())
               System.out.println("Queue is empty and we are in while");
            queue.print();
         c = queue.dequeue();
            System.out.print("Item just dequeued: ");
            c.print();
            System.out.println("");
            if(c.isEqualTo(b)){
                System.out.println("found is :" + found);
                found = 1 ;
                System.out.println("found is :" + found);
         x=c.getX();
         y=c.getY() ;
         value = grid[x][y].getValue();
         //This method is based on that every square has four neighbours,
         //so each time we dequeue a square from the queue, we label its
         //neighbours(up,down,left and right), but there are some constraints
         // such as if the neighbour is marked , is a block or out of the
         //bound of the matrix
       if ((x+1)<m && grid[x+1][y].getValue() != -2 && grid [x+1][y].getMark()!= 1)
                    queue.print();
              grid[x+1][y].setValue(value +1);
                    System.out.println("d is before modifying it: ");
                    d.print();
                    queue.print();
              d.setX(x+1);
                    d.setY(y);
              grid[x+1][y].setMark(1);
                    queue.print();
                    System.out.println("d after modifying it & before inserting into the queue: ");
                    d.print();
                    System.out.println("QUEUE BEFORE ENQUEUE(D)");
                    queue.print();
              queue.enqueue(d);
                    System.out.println("QUEUE AFTER ENQUEUE(D)");               
                    queue.print();
                    System.out.print("Location ");               
                    d.print();
                    System.out.println(" is being labeled");
                    System.out.println("Grid after new label");
           for(int i = 0; i < m; i++)
                System.out.println("");
            for (int j=0; j<n; j++)
              System.out.print(grid[i][j].getValue()) ;
              System.out.print("  ");
                     System.out.println("");
       if ((x-1)>-1 && grid [x-1][y].getValue() != -2 && grid [x-1][y].getMark()!= 1)
              grid[x-1][y].setValue(value +1);
                    System.out.println("d is before modifying it: ");
                    d.print();
                    d.setX(x-1);
                    d.setY(y);
              grid[x-1][y].setMark(1);
                    System.out.println("d after before modifying it & before inserting into the queue: ");
                    d.print();               
                    System.out.println("QUEUE BEFORE ENQUEUE(D)");
                    queue.print();
              queue.enqueue(d);
                    System.out.println("QUEUE AFTER ENQUEUE(D)");               
                    queue.print();
                    System.out.print("Location ");               
                    d.print();
                    System.out.println(" is being labeled");               
                    System.out.println("Grid after new label");
                    for(int i = 0; i < m; i++)
                     System.out.println("");
            for (int j=0; j<n; j++)
              System.out.print(grid[i][j].getValue()) ;
              System.out.print("  ");
                               System.out.println("");
         if ((y+1)<n && grid [x][y+1].getValue()!= -2 && grid[x][y+1].getMark()!= 1)
              grid[x][y+1].setValue(value +1);
              System.out.println("d is before modifying it: ");
                    d.print();
                    d.setX(x);
                    d.setY(y + 1);
              grid[x][y+1].setMark(1);
                    System.out.println("d after before modifying it & before inserting into the queue: ");
                    d.print();               
                    System.out.println("QUEUE BEFORE ENQUEUE(D)");
                    queue.print();
              queue.enqueue(d);
                    System.out.println("QUEUE AFTER ENQUEUE(D)");               
                    queue.print();
                    System.out.print("Location ");               
                    d.print();
                    System.out.println(" is being labeled");               
                    System.out.println("Grid after new label");
                            for(int i = 0; i < m; i++)
                    System.out.println("");
            for (int j=0; j<n; j++)
              System.out.print(grid[i][j].getValue()) ;
              System.out.print("  ");
                               System.out.println("");
         if ((y-1)>-1 && grid [x][y-1].getValue() != -2 && grid[x][y-1].getMark()!= 1)
              grid[x][y-1].setValue(value +1);
                    System.out.println("d is before modifying it: ");
                    d.print();
                    d.setX(x);
                    d.setY(y - 1);
              grid[x][y-1].setMark(1);
                    System.out.println("d after before modifying it & before inserting into the queue: ");
                    d.print();               
                    System.out.println("QUEUE BEFORE ENQUEUE(D)");
                    queue.print();
              queue.enqueue(d);
                    System.out.println("QUEUE AFTER ENQUEUE(D)");               
                    queue.print();
                    System.out.print("Location ");               
                    d.print();
                    System.out.println(" is being labeled");               
                    System.out.println("Grid after new label");
                    for(int i = 0; i < m; i++)
                    System.out.println("");
            for (int j=0; j<n; j++)
              System.out.print(grid[i][j].getValue()) ;
              System.out.print("  ");
                               System.out.println("");
    }//end of while
    //Printing out the whole matrix
            for(int i = 0; i < m; i++)
              System.out.println("");
            for (int j=0; j<n; j++)
              System.out.print(grid[i][j].getValue()) ;
              System.out.print("  ");
       }//end of labelGrid()This is part of the output, note how the queue changes and clones the new item
    Queue is currently :
    (4,3)
    Location (4,3)
    is being labeled
    Grid after new label
    -1 -1 -1 -1 -1 -1 -1 -1
    -1 -1 -1 -1 -1 -1 -1 -1
    -1 -1 -1 -1 -1 -1 -1 -1
    -1 -1 -1 0 -1 -1 -1 -1
    -1 -1 -1 1 -1 -1 -1 -1
    -1 -1 -1 -1 -1 -1 -1 -1
    -1 -1 -1 -1 -1 -1 24 -1
    d is before modifying it:
    (4,3)
    d after before modifying it & before inserting into the queue:
    (2,3)
    QUEUE BEFORE ENQUEUE(D)
    Queue is being accessed for print
    Queue size is: 1
    Queue is currently :
    (2,3)
    Queue is being accessed for enqueue
    Queue is being accessed for print
    Queue size is: 1
    Queue is currently :
    (2,3)
    Queue size before adding is: 1
    Item added to the queue: (2,3)
    Queue size after adding is: 2
    Queue is being accessed for print
    Queue size is: 2
    Queue is currently :
    (2,3)
    (2,3)
    QUEUE AFTER ENQUEUE(D)
    Queue is being accessed for print
    Queue size is: 2
    Queue is currently :
    (2,3)
    (2,3)
    Location (2,3)
    is being labeled
    Hope you could help out:
    thanks!

    Thank for your reply Paulo! Sorry, the posting of the attachment did not work. Here is the code.
    Attachments:
    Measure.llb ‏50 KB

  • "Eval Parsed Formula Node VI" does not return outputs in predefined order

    I make a data analysis program, where the data consists of some million events and each event has e.g. 4 channels and 1-5 hits on each channel. 
    I would like the user to select different expressions of these channels to give coordinates to plot in a 2D histogram (increment a bin in Intensity Graph), e.g. for some experiment you want to show x=ch1-ch2; y=ch1+ch2+ch3+ch4; while in another experiment you want x=ch1-123; y=123-ch2;
    There are other VIs that use static LabView-code for the normal things, but now after a few years of adding to this program I find that it would be quite good with a general plotter and let the user specify simple expressions like this. Also with the "normal" static plots, there is a need to filter out bad data and then it would be much simpler both to program and use if you could write text expressions with boolean logic to combine multiple filters. Making a LabView code and GUI that allows AND/OR/parenthesis combinations of expressions will be quite an effort and not very reusable.
    So, with the above motivation, I hope you see that it would make sense to have a useable string formula evaluator in LabView. I find some info about MathScript's user-defineable functions, but haven't managed to get MathScript working in LV2010 yet (maybe some licensing or installation issues, I think I had it in 8.6). But I think it would be possible to do most of what I want for the display-part (not the filtering) with the simpler Eval/Parse Formula Node VIs and suitable use of the limited variable name space. So I started testing, and found a quite annoying issue with how the evaulator works.
    To the parser, you are expected to send an array of output variable names. But then it ignores this array, and returns one output per assignment/semicolon in the formula, in the order of the formula text. Since the static parts of my program need to know what the output values mean (which of them is x and which is y), I would have to rely on the user not using any intermediate variable and defining x before y. The attached screenshot demonstrates the problem, and also that it has been solved by NI statff in the "Eval Formula Node VI" which does the appropriate array-searching to extract only the pre-defined outputs, in their expected order. But using that VI is about 100 times as slow, I need to pre-compile the formula and then only use the evaulator in the loop that runs over a million events.
    I don't know if I'll take the time to make my own tweks to the parsing stage (e.g. preparation of array-mapping to not have to repeat the search or maybe hacking the output list generated by the parser) or if I'll have to make it in a static Formula Node in the block-diagram (which supports more functions), so that the user has to run with development environment and stop the program to change the plotting function. But I wanted to share this trouble with you, in hope of improvments in future LabView versions or ideas from other people on how I could accomplish my aim. I have MATLAB-formula node possibility too, but is far as I have seen the only place the user could update the formula would then be in a separate .m file, which is re-read only when typing "clear functions" in the Matlab console window. (Having this window is also an annoyance, and perhaps the performance of calling Matlab in every iteration is not great.) 
    Besides this issue, it also seems very strange there is virtually no support for conditional expressions or operators in Formula Node evaulated formulas (called Mathematics VIs in the documentation). Maybe using (1+sign(a-b))/2 you can build something that is 0 when a<b and 1 when a>b, but it is not user friendly! Would it really be diffcult to add a function like iif(condition, return_value_if_true, return_value_if_false) to replace the unsupported "condition ? if_true : if_false" operator? Would it really be difficult to add support for the < <= >= > == || && operators? Although compiled to an assemply language, this can't exactly be difficult for a CPU.
    Attachments:
    LV script test.png ‏62 KB
    LV script test.vi ‏18 KB

    (1) You can put any kind of code inside an event structure with the limitation that it should be able to complete quickly and without user interaction.  For example a while loop for a newton-raphson method is fine, but an interactive while loop where the stop condition depends on user iteraction is not recommended. By default, event structures lock the front panel until the event completes, so you would not even be able to stop it.
    (2) Yes, you can do all that. LabVIEW has no limitation as a programming language. Use shift registers to hold data and state information, the manipulate the contents as needed.
    (3) I would recommend to use plain LabVIEW primitives instead of formula nodes. Show us your code so we can better see what it's all about. Obviously you have a mismatch betweeen scalars and arrays. It is impossible from the given information where the problem is.
    (4) Yes, look inside the nonlinear curve fit VI (you can open it an inspect the code!). One of the subVIs does exactly that. Just supply your model VI.
    LabVIEW Champion . Do more with less code and in less time .

  • Legend in graphs

    The plot function is CW is great but does not have a built-in legend.
    Are there any examples of a plot with legend available?

    Create a property node for your graph. Use the property node "Active Plot" to define which plot (or line) you want to rename. Then write the new legend label to the property node "Plot.Name". See attached.
    Tim
    Attachments:
    legend.vi ‏12 KB

  • Date/Time on X-Axis with JFreeChart

    Hi guys,
    I've asked this question on the JFreeChart forums, but got no response.
    If anyone has any experience with JFreeChart, help would be most appreaciated.
    I am drawing a XY Line Chart to display CPU usage retrieved from a database. The user can search with specific dates/times (eg: from: 24/2/2005 to: 16/4/2005) - and then these results would be graphed.
    My question is, how do I use dates/times on the X-axis using JFreeChart?
    The results I am getting from the DB would be a time-stamp and CPU usage.
    Here is my current code, but it wont work with a time-stamp:
    public static class ChartTest   {
        public ChartTest()
            // create a dataset...FOR LOOP
            XYSeries dataSet = new XYSeries("CPU Usage");
            TimeSeries closing = new TimeSeries( "Closing Value", Day.class );
         for(int h=0; h < newArray[0].length; h++)
            for(int i=0; i < newArray.length; i++)
               dataSet.add(newArray[i][h], newArray[i][h++]);
            XYDataset xyDataset = new XYSeriesCollection(dataSet);
            // create a chart...
            JFreeChart lineGraph = ChartFactory.createXYLineChart
                        ("Mitch's CPU Usage Test",  // Title
                          "Time",           // X-Axis label
                          "CPU Load",           // Y-Axis label
                          xyDataset,          // Dataset
                          PlotOrientation.VERTICAL,        //Plot orientation
                          true,                //show legend
                          true,                // Show tooltips
                          false               //url show
            // create and display a frame...
            ChartFrame frame = new ChartFrame("CPU Usage Test", lineGraph);
            frame.pack();
            frame.setVisible(true);
        }

    The JFreeChard demo should give you the idea
    package demo;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.text.SimpleDateFormat;
    import javax.swing.JPanel;
    import org.jfree.chart.*;
    import org.jfree.chart.axis.DateAxis;
    import org.jfree.chart.plot.XYPlot;
    import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
    import org.jfree.data.time.*;
    import org.jfree.data.xy.XYDataset;
    import org.jfree.ui.*;
    public class TimeSeriesDemo1 extends ApplicationFrame
        public TimeSeriesDemo1(String s)
            super(s);
            XYDataset xydataset = createDataset();
            JFreeChart jfreechart = createChart(xydataset);
            ChartPanel chartpanel = new ChartPanel(jfreechart, false);
            chartpanel.setPreferredSize(new Dimension(500, 270));
            chartpanel.setMouseZoomable(true, false);
            setContentPane(chartpanel);
        private static JFreeChart createChart(XYDataset xydataset)
            JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date", "Price Per Unit", xydataset, true, true, false);
            jfreechart.setBackgroundPaint(Color.white);
            XYPlot xyplot = (XYPlot)jfreechart.getPlot();
            xyplot.setBackgroundPaint(Color.lightGray);
            xyplot.setDomainGridlinePaint(Color.white);
            xyplot.setRangeGridlinePaint(Color.white);
            xyplot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
            xyplot.setDomainCrosshairVisible(true);
            xyplot.setRangeCrosshairVisible(true);
            org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
            if(xyitemrenderer instanceof XYLineAndShapeRenderer)
                XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer)xyitemrenderer;
                xylineandshaperenderer.setDefaultShapesVisible(true);
                xylineandshaperenderer.setDefaultShapesFilled(true);
            DateAxis dateaxis = (DateAxis)xyplot.getDomainAxis();
            dateaxis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
            return jfreechart;
        private static XYDataset createDataset()
            TimeSeries timeseries = new TimeSeries("L&G European Index Trust", org.jfree.data.time.Month.class);
            timeseries.add(new Month(2, 2001), 181.8);
            timeseries.add(new Month(3, 2001), 167.3);
            timeseries.add(new Month(4, 2001), 153.8);
            timeseries.add(new Month(5, 2001), 167.6);
            timeseries.add(new Month(6, 2001), 158.8);
            timeseries.add(new Month(7, 2001), 148.3);
            timeseries.add(new Month(8, 2001), 153.9);
            timeseries.add(new Month(9, 2001), 142.7);
            timeseries.add(new Month(10, 2001), 123.2);
            timeseries.add(new Month(11, 2001), 131.8);
            timeseries.add(new Month(12, 2001), 139.6);
            timeseries.add(new Month(1, 2002), 142.9);
            timeseries.add(new Month(2, 2002), 138.7);
            timeseries.add(new Month(3, 2002), 137.3);
            timeseries.add(new Month(4, 2002), 143.9);
            timeseries.add(new Month(5, 2002), 139.8);
            timeseries.add(new Month(6, 2002), 137.0);
            timeseries.add(new Month(7, 2002), 132.8);
            TimeSeries timeseries1 = new TimeSeries("L&G UK Index Trust", org.jfree.data.time.Month.class);
            timeseries1.add(new Month(2, 2001), 129.6);
            timeseries1.add(new Month(3, 2001), 123.2);
            timeseries1.add(new Month(4, 2001), 117.2);
            timeseries1.add(new Month(5, 2001), 124.1);
            timeseries1.add(new Month(6, 2001), 122.6);
            timeseries1.add(new Month(7, 2001), 119.2);
            timeseries1.add(new Month(8, 2001), 116.5);
            timeseries1.add(new Month(9, 2001), 112.7);
            timeseries1.add(new Month(10, 2001), 101.5);
            timeseries1.add(new Month(11, 2001), 106.1);
            timeseries1.add(new Month(12, 2001), 110.3);
            timeseries1.add(new Month(1, 2002), 111.7);
            timeseries1.add(new Month(2, 2002), 111.0);
            timeseries1.add(new Month(3, 2002), 109.6);
            timeseries1.add(new Month(4, 2002), 113.2D);
            timeseries1.add(new Month(5, 2002), 111.6);
            timeseries1.add(new Month(6, 2002), 108.8);
            timeseries1.add(new Month(7, 2002), 101.6);
            TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
            timeseriescollection.addSeries(timeseries);
            timeseriescollection.addSeries(timeseries1);
            timeseriescollection.setDomainIsPointsInTime(true);
            return timeseriescollection;
        public static JPanel createDemoPanel()
            JFreeChart jfreechart = createChart(createDataset());
            return new ChartPanel(jfreechart);
        public static void main(String args[])
            TimeSeriesDemo1 timeseriesdemo1 = new TimeSeriesDemo1("Time Series Demo 1");
            timeseriesdemo1.pack();
            RefineryUtilities.centerFrameOnScreen(timeseriesdemo1);
            timeseriesdemo1.setVisible(true);
    }

  • Xy graph 1 spot in each axis

    Hi all:
    I'm plotting voltage and current in a XY graph. The fact is that instead of plotting just a spot (voltage/current coordinates), it plots 1 spot in the x axis(making 0 the Y axis), and in the next while bucle iteration it plots in the Y axis (making 0 the X axis). When I'm debugging using step by step option it plots it correctly, I think maybe its a time problem.
     Im using NI-elvis to adquire the measurement.  Im getting mad with this so please a need help.
    Thanks so much

    If the outcome is different when using step-by-step execution, you most likely have a race condition (or the graph update is only temporary and gets overwritten quicky with something else). Please show us a simplified version of your code and make sure it contains typical data.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • ALV colouring download to excel sheet

    Hi Experts , I have a requirement in which I have coloured the cells of the ALV display , in order to highlight them. I have made use of 'REUSE_ALV_GRID_DISPLAY' FM for displaying ALV. When I  download this output to an excel sheet , the colour fille

  • Airplay on 1st generation apple tv

    How do you use airplay on 1st generation apple tv

  • I'm looking for a preference in Photoshop.

    I know I've done it before, but I don't know where it is. I'm using Photoshop 5 and I want to change the setting where I can just click on an object and modify it without FIRST selecting the layer and then modifying the object.

  • TREX - Search, Classification, Taxonomies and Indexes configuration

    hey,      I have successfully installed TREX 6.1 and would like to set up Search, Classification, Taxonomies on Enterprise Portal and set up indexes on TREX.      How do i do this? Is there any documentation detailing step-by-step procedure to achiev

  • SAP Netweaver Developer Studio Download?

    Where can I download this from that works quick and easy. I am having problems downloading from some sites?    Thank-You