LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read 2 scales on 1 graph

Hi guys,

 

- I have a graph displaying 2 plots (amplitude and phase) at the same time.

- The amplitude scale on the left and phase scale on the right.

- I'm using a graph cursor in SINGLE-PLOT MODE.

 

I'm trying to switch between both scales using "Cursor.Yscale" and/or "Plot.YScaleIdx" properties to read the coordinates of the cursor according to each one of the scales.

While it works fine when the cursor is in FREE mode, I get the same reading before and after switching the scale in single-point mode. That is, Y1amp and Y1phase indicators display the same result.

 

The reading is done in a while loop as seen in the attached picture (example for 2 cursors).

 

Any idea what am I missing?

 

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

Read the HELP for the Cursor.YScale property:

This property is valid only for FREE CURSORS.  When the cursor is associated with a plot, this property might be overwritten by the plot.

 

You are violating that restriction.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 5
(2,264 Views)

Options:

1... Leave the cursor attached to the AMPLITUDE plot.  Read the X value and use that value to look up the associated PHASE value in your data.

 

2... Create a hidden (transparent) cursor (#1) and attach it to the PHASE plot.  Set the X value of cursor #1 to the X-value of cursor #0 and THEN read out the associated phase value.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 5
(2,260 Views)

Hi Steve,

 

Thanks for the prompt reply.

 

Regarding your solution, I think it would give me the Y value of the second plot for the same Theta point. For example, applying solution#1 on the blue cursor in the picture would give me a result of about -115 deg. (the point the vertical line of the cursor crosses the red phase line. This is not what I wanted, I need the "vertical" value of the cursor on both scales (about -38dB on Amp. scale and about +78 deg. on the phase scale.

Or did I misunderstand?

 

Any way, you did give me a new thinking direction that seems to be working:

a) I read the Amp. scale position of the cursor and calculate the its relative part of the whole scale (for example, if the scale goes from 0 to -100db and the current position is -25dB, then I know the position is a quarter of the whole scale).

 

b) Now, I calculate a quarter of the phase scale and get the missing phase position.

It's a nice workaround.

 

Thanks for the idea!

0 Kudos
Message 4 of 5
(2,239 Views)

Both solutions I offered accomplish the same thing; the idea is that you use the X value of the cursor to "look up" the corresponding Y value in the 2nd plot.

 

Either you look it up yourself (in case you still have the data arrays around), or you use the hidden cursor to look it up for you (in case you don't).

 

Happy New Year !

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 5
(2,237 Views)