LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When zoomed in on a waveform graph, how do I obtain the set of data points that is currently displayed on the graph?

Solved!
Go to solution

I am using the X-zoom tool on the graph palette. In this graph, the x-axis is time. So, for example, if I have 30 seconds displayed on the x axis for the full graph, and I want to zoom in on the middle 10 seconds, how do I obtain the y axis data points that correspond to this middle 10 seconds?

0 Kudos
Message 1 of 12
(5,134 Views)

What do you mean by you want to "obtain" the data points.

Would you like the y-axis to scale accordingly when the x-axis changes?

Or do you mean you would like an array of all of the data in the selected range?

Cory K
0 Kudos
Message 2 of 12
(5,118 Views)

Perhaps a cursor would be sufficient?

0 Kudos
Message 3 of 12
(5,115 Views)

Thanks for responding.

 

I am looking for an array of all of the data in the selected range.

0 Kudos
Message 4 of 12
(5,111 Views)

Could you use Smercurio's advice?
You could set a cursor at t1 and a second cursor at t2.

Then you could use the x-position of each of the cursors as indexes.

You could then index out a subarray from your entire array of data.


Give that a shot, and let us know if that was unclear or you need a hand.

Cory K
0 Kudos
Message 5 of 12
(5,104 Views)

Thank you again for responding. Actually I would prefer not to use cursors, as that requires user interaction. X-zoom zooms in on a section of a waveform graph. What I am wanting is the y data points corresponding to resulting graph.

0 Kudos
Message 6 of 12
(5,094 Views)
Solution
Accepted by topic author christopher

Similar to Cory's suggestion, could you use the X-Scale->Range->Min and Max properties to pull the appropriate data?

Maybe even link your data pull to the Scale Range Change event? 

0 Kudos
Message 7 of 12
(5,087 Views)

Here is a quick example.

I was a little slow, Taki beat me to the punch Smiley Tongue

Cory K
0 Kudos
Message 8 of 12
(5,084 Views)

If you are using a waveform graph and you said that you have 30 seconds displayed, my guess is that you are dealing with waveform data. In this case when you zoom in you can respond to the scale change event, as Taki mentioned. You will need to determine which indices to pull out by interpolating the scale's minimum and maximum values within the X values. You can use the Interpolate 1D Array function to do this. See attached example (LV 8.2). Modify as needed.

0 Kudos
Message 9 of 12
(5,074 Views)

Thank you Taki and Cory. I like Taki's idea of using the X-Scale->Range->Min and Max property to obtain the data points. I will try that today and respond back.    I will also view your example code Cory.  

0 Kudos
Message 10 of 12
(5,068 Views)