06-22-2010 07:45 AM
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?
Solved! Go to Solution.
06-22-2010 09:22 AM
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?
06-22-2010 09:32 AM
Perhaps a cursor would be sufficient?
06-22-2010 09:34 AM
Thanks for responding.
I am looking for an array of all of the data in the selected range.
06-22-2010 09:42 AM
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.
06-22-2010 09:52 AM
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.
06-22-2010 09:58 AM
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?
06-22-2010 10:01 AM
Here is a quick example.
I was a little slow, Taki beat me to the punch
06-22-2010 10:14 AM
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.
06-22-2010 10:22 AM
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.