LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot XY graph from 2 input... Problem: At the same position, the graph still shows 2 value of y!

I have to plot XY graph, the graph move from left to right and then right to left.....But it got problem: At the same position, the graph still shows 2 value of y.  I don't know how to update new value , and delete the previous value for y. Any one has a good example?
Download All
0 Kudos
Message 1 of 11
(4,877 Views)
Hi ha noi,
 
Thanks for contacting National Instruments.  I have been looking into your question about the XY Graph and I have a suggestion for you.  The reason that you are seeing this issue is because you are assigning data on the graph to the exact same X position.  Unfortunately, this is how the graphs work.  A couple of things you could look at would be to create multiple graph areas that you could plot the data on the same X positions.  This way, you could have the data on multiple plots right next to each other where you could compare them easily.  Also, another thing you could do would be to play around with the invoke node "Reinitialize to Default" for the XY graph.  However, this will reset the entire graph to blank, so you will rewrite any information on there.  Please look into these options and if you still have any questions, feel free to reply back.  Thanks!
Regards

Noah R
Applications Engineering
National Instruments
0 Kudos
Message 2 of 11
(4,811 Views)
Thank you for your hints. In the graph, I want to update new Y value at X position, and delete old Y value of that position, but i don't want to delete other Y value at other X position ( if Y value still waiting for update). Do you have any ideal or example?
0 Kudos
Message 3 of 11
(4,790 Views)
Instead of an xy graph use a waveform graph.
 
Initialize an array with one element for each desired x position. Now just replace the element at the desired index with a new value and send the array to the graph terminal.
0 Kudos
Message 4 of 11
(4,784 Views)

OK, you are doing this all way too complicated.

  1. Why do you need to keep three identical x arrays, one is enough! Don't be afraid to branch a wire!
  2. What's with all that song and dance with xy graphs? Since the x values are spaced equally, you only need a waveform graph.
  3. Whats up with all that convoluted logic and shift registers just to count up and down?

Here's a streamlined version (LV 8.5) that seems to do basically the same. 🙂

Let me know it this makes sense. It probably needs a tweak here and there to do exactly what you want. 🙂

As you can see, everything operates "in place". No more building of arrays and such.

(I am relatively impatient watching a program, so I sped up the code by a factor of 5. Set the wait back to 1000ms if you prefer that).

0 Kudos
Message 5 of 11
(4,775 Views)

Thank for your program! It's graph i want to see! I will try to understand your program.

Best regard,

0 Kudos
Message 6 of 11
(4,772 Views)
Please ask if you have problems undestanding some of the code constructs. 🙂
 
The code could be even more simplified, for example we don't need a while loop since the total number of iterations can be determined before the loop starts. (still we might want to keep the while loop and add a button to interrrupt the process if needed).
0 Kudos
Message 7 of 11
(4,759 Views)
Hi altenbach,
 
Do you have any way to auto resize of array?
 
 
0 Kudos
Message 8 of 11
(4,715 Views)


ha noi wrote:
Do you have any way to auto resize of array?

Sorry, I don't understand the question. How should the program know what size you want?
0 Kudos
Message 9 of 11
(4,690 Views)
Hi altenbach,
Sorry, I uploaded the wrong picture. I want to create program with labview to measure the position and value of sensor. The sensor moves forward and back , and send the value it  measured. At 1 position, there are maybe more than 1 measurement.That the meaning of demo program.
In program, i got problem with the length of array ( I showed it in picture), so I just put big value for length:100. But it's not the way I should do. Do you have any ideal to make the length auto increase ( or the array doesn't care about the length)? Thanks.
Download All
0 Kudos
Message 10 of 11
(4,667 Views)