LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to zoom in X-axis of a XY graph

Solved!
Go to solution

Hi Friends,

 

I am wondering is there any way to zoom in both X and Y axis at the same time? I need to zoom in a graph for a better data selection for subsequent data processing.

   

I have graph palette and cursor legend open on front panel, but the zoom in just works for Y-axis. 

 

Could someone help with the issue? Attached is a sample VI for troubleshooting purpose only. 

Thanks,

Gu

0 Kudos
Message 1 of 8
(4,833 Views)

Works just fine if you select the correct zoom mode (upper left).

 

zoomtool.png

0 Kudos
Message 2 of 8
(4,824 Views)

@edmonton wrote:

Attached is a sample VI for troubleshooting purpose only. 


While it's only a sample VI, you have some serious code issues and race conditions. Hopefully these don't exist in your actual code.

 

For example in the lower right loop, the property node gets read as soon as the loop start, so if you move the cursors and press "data selection", you'll operate on the stale cursor positions.

Similarly, the upper right loop ("greedy" for no reason!) could be done significantly simpler using an array of offsets and autoindexing. You already have the transposed array, so use that. No case structure needed. ("array subset" is convoluted to get a column, "index array" is correct.). Etc.)

0 Kudos
Message 3 of 8
(4,798 Views)

Hi Dr  Altenbach,

 

Thank you for your prompt reply. I do not know why the upper-left option does not work on my computer, it only works to zoom in Y as selected, leaving the X unchanged. 

 

Attached is a screen shot of zooming in a area of X:0-8, Y:0-100000, the Y changed as wanted, however, the X is still in its original range 0-16.

 

The upper right loop, the plot loop, is for shifting/offsetting each curve separately on X axis as needed, each curve requires a different offset value depending on their real data situation. I wanted to make it simple, but could not make it.

 

Yes, there might be a race condition between the loops. It can run smooth, but uses CPU at almost 100% after the first data selection operation of the lower property node loop. I am also looking for a solution to avoid CPU usage at such a high %. both the upper and the lower loops have interactive operation. Ideally, the operation should  be XY plot, zoom in, curve shift, cursor move and data selection. Could you please advise how to make the code a better fit?

 

Best regards,

Gu

Zoom in X0-8 & Y0-10000.png

 

0 Kudos
Message 4 of 8
(4,780 Views)
Solution
Accepted by topic author edmonton

Maybe you want to turn off auto-scaling for the x-axis? Your loop spins millions of times per second, so auto-scaling will take over immediately undoing the x-zooming.

 

The race condition is not between loops, but in the loop with the event structure. As I said, the property node gets read right away, so when the event fires, you display the cursor values from the previous iteration. You need to press the button at least twice after moving the cursors to get expected values.. 

 

If you would place a small wait in the upper right loop, the CPU usage would drop to near zero. No need to heat the room with the CPU. 😮

 

Here's basically a literal rewrite of your code with simpler data structure (note that the architecture is NOT good, it just shows some typical techniques. Code that just runs downhill and can never return to a previous loop in not reasonable!).

 

Recommendation: Still, you should not need all these parallel loops. All you really need is a simple state machine that can start/stop acquisition, change the offsets, and read the cursors all in one loop. Try it! 

Message 5 of 8
(4,757 Views)

Good Morning Dr Altenbach,

 

Thank you very much for all your effort and enthusiasm helping me out. 

The use of Re/Im really makes code simple, I need to learn and practice to use it in my future code.

 

Originally, I tried to use event case for data selection in the upper loop before posting the issue, the curve shift stopped working, then I moved the data selection out and used a parale loop. I will try it again with your code.

 

By the way, how to make the indicators small as you did in block diagram? I alway get big boxes.

 

Regards,

Gu

 

  

 

0 Kudos
Message 6 of 8
(4,711 Views)

@edmonton wrote:

By the way, how to make the indicators small as you did in block diagram? I alway get big boxes.


"right-click terminal...view as icon" (checked or unchecked)

 

(You can turn it off permanently for all new terminals in "tools...options..block diagram...place front terminals as icons...uncheck")

Message 7 of 8
(4,703 Views)

Hi Dr  Altenbach,

Thanks.

 

I really do not like icons, I normally use details in file view of windows, icons make me daze.

 

Gu

 

0 Kudos
Message 8 of 8
(4,696 Views)