LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graph history

Hi,

I'm trying to display points as distinct plots in an XY Graph to be able to change their color one by one.

To achieve this, I have built a cluster out of every point, and then tried to display it in the XY Graph.

I have run into several problems.

1. By default, the plot style is set to none, so I would have to change every point style one by one. I have tried to do this by an active plot property, but it's hard to index the plots in the nested for loops they are created in. Can you recommend a way to index the plots? 

2. The other problem was that the XY Graph kept the points from previous runs. If I created for instance a 9x9 grid, and then tried to display a 3x3 one, the bigger grid's plots were still in the history of the Graph, which caused several problems.

3. During testing, the program got very slow, responded with delay and stopped responding after a while. 

Could you help me sort out these issues?

Thank, 

Misi

0 Kudos
Message 1 of 5
(1,184 Views)

Please attach your VI. We cannot debug pictures.

It keeps your previous plots because your shift registers are not initialized. (you data grows forever, thus it will slow down after a while. You run out of memory!)

Why do you need two loops?

Your control has the wrong representation (should be I32).

Since your points are spaced equally, you really don't need an xy graph.

Maybe an intensity graph would be a better choice?

0 Kudos
Message 2 of 5
(1,159 Views)

Hi, thanks for your answer! How should I initialize the shift registers, with empty arrays? I've done it now, but it didn't get better. And the plot's style is not visible by default, how should I set each of them? I'm not getting it due to the indexing problem I've written about above.

An intensity graph is not an option, as I will have to draw some lines, too. I'm trying to do such a simulation:

http://galileoandeinstein.physics.virginia.edu/more_stuff/Applets/ChainReaction/chain.html

if you have any idea on how to do it in a better way, let me know.

Here's the program I have written so far.

 

0 Kudos
Message 3 of 5
(1,143 Views)

I would recommend to do a few tutorials, tehre are a lot of things that don't make sens in your current code.

 

  • If start is not pressed, your VI consumes 100% of a CPU code, polling the buttons millions of times per second and the computer is heating your room. You need a small wait.
  • It is very inefficient to prepend elements to an array (i.e. add new values at the beginning) because that requires significantly more efforts by the memory manager.
  • XY graph understand complex 1D arrays, giving you significantly simpler data structures.
  • If you want to change the active plot, you need to wire [i] to the active plot (but since you are currently prepending, things will get very messy associating style with a given plot.
  • You only need two plots, not an infinite amount. All the dots can be the same plot. Then use a second plot for the particle.
  • The first plot can be retained in a shift register of the outermost while loop, then add the particle path plot as needed.
  • As I said, your control needs to be an integer. You cannot have a fractional number of dots.
  • Start button need to latch action.
0 Kudos
Message 4 of 5
(1,128 Views)

See if this can give you some ideas.

 

altenbach_0-1606605819824.png

 

The grid plot only needs to be calculated once and whenever the grid size changes. Now you just need to add a second plot for the particle trace simulation and combine both for display.

 

0 Kudos
Message 5 of 5
(1,125 Views)