LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Realtime Intensity Graph When X and Y do not start from zero

Solved!
Go to solution

Hello! I have a very simple problem but I am surprised it does not seem to have been addressed here. 

 

I want to plot an intensity graph in real time from data generated within two for loops (I am scanning in XY and obtaining data at each point). The X and Y axes values are also generated within the for loops, and they are a function of the loop iteration but do not start from zero, (for example, the x axis might go from 50 to 70 and the y axis might go from 100 to 120). 

 

Because the intensity graph only accepts a 2D array data type where the x and y indices are the x and y values on the intensity graph, this means that, although my data is only in a 20x20 area of the array, I need to initialize my array to be at least 70x120 given that the maximum y axis value is 120. This then poses problems when the data is plotted in the graph as it does not autosize properly.

 

How do I plot an intensity chart in real time with the correct axes values that does not require a much larger array than the data size??? 

 

Thank you in advance! (I am attaching an example which demonstrates my problem) 

 

 

0 Kudos
Message 1 of 6
(1,313 Views)
Solution
Accepted by lucy_001

You can use Property Node -->XScale/YScale--> Range --> Minimum/Maximum to set the limits of the chart.

 

 

EDIT: The VI you attached is empty...

Message 2 of 6
(1,305 Views)

This helps a lot with the plotting, thanks! I didn't know about property nodes but i do now!  

 

However I still need to initialize a larger array than i need. Is there away to get around this? (If my X and Y values start at 1000 for example, it seems a waste to have to create a 1000x1000 array)

 

I've attached the file properly now! Sorry about that 

0 Kudos
Message 3 of 6
(1,292 Views)

It should be possible to set the Offset and Multiplier for the scales appropriately, so that your data ends up in a 30x20 array or whatever and the scales end up reading from 70-100 and 100-120.

 

See https://zone.ni.com/reference/en-XX/help/371361R-01/lvprop/clrgrphscl_ofst_multiofst/ for one of the properties.

 

You can adjust these to test quickly using the right click -> properties page for the graph (or the property node in an event structure and then controls for them to update with data already loaded, can be useful to explore how they work).


GCentral
0 Kudos
Message 4 of 6
(1,253 Views)
Solution
Accepted by lucy_001

Here's a snippet with that shown. I just indexed out of the loop for simplicity, but you could still do this with the Replace Array Subset (and an appropriately sized array, for the data, not the indices).

IntensityGraphIssue.png

Here I just right clicked on the graph and chose to change the Offsets under the Scales (there's a dropdown for X and Y axes).

cbutcher_1-1623245226967.png

 

If you need to do it programmatically, there's the property node linked in my previous post.

cbutcher_2-1623245265788.png

The easy way to create these is to right click on the graph on the block diagram and then choose Create > Property Node > (scroll down lots) X Scale (or Y Scale, as appropriate) > Offset and Multiplier > Offset (or Multiplier, or all elements, in which case you get a cluster). Then right click on it and choose Change to Write (by default you get a Read property node, that tells you the current value). You can drag a Property Node downwards like I've done here to get multiple properties in one place (convenient for space on block diagram).

 

You can also modify the multiplier (the values are as you calculate using the "i" value in the loops previously), but since you're not using a different multiplier you can leave this at 1 (in this case).


GCentral
Message 5 of 6
(1,247 Views)

Yes this is what I was after! Thanks - using a combination of this and the answer above it works 🙂

0 Kudos
Message 6 of 6
(1,200 Views)