LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to adjust the scale of a graph using reference points?

Solved!
Go to solution

Hi,

 

I'm working on some code to display data from a spectrometer.  I've got to the point of producing an energy vs. intensity graph, but I'm having some problems calibrating the x axis (energy).

 

The customer wants to be able to insert filters with a cut-off at known energies, and use those points to work out what positions on the graph correspond to what energies.  In programming terms, I need to  let the user click on the graph at two points with known values, and use those points to recalculate the XScale multiplier and offset (I think).

 

I've tried a few different things, and attached  by best attempt so far.  It's a simplified example, but I hope it captures enough of the problem to be useful.  I can't help thinking there must be a simpler way to do this.  Any suggestions?

0 Kudos
Message 1 of 5
(3,332 Views)
Solution
Accepted by topic author Siwa
What you have done is good. The only thing that I would have a problem whit is there is no visual response on the graph for the user. You can also do this with cursors. Let them slide cursors on to the two points. It is more visual and you can see where you have selected. I am not sure that it will be much easier than what you have done. You could also use a hybrid of the two methods and have the cursor move to the point that you have selected.
Tim
GHSP
Message 2 of 5
(3,316 Views)
I knew there had to be a simpler way 🙂  The full program was drawing a vertical line where the user clicked, but had the problem shown in the first VI (repeatedly clicking on the same point gives different results).  Changing to cursors solved that, and improved the user interface in the process.  Thanks!
0 Kudos
Message 3 of 5
(3,304 Views)

Dumb question to follow!

 

Did you try using the builtin zoom tool?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(3,297 Views)
I did try it (if you mean the one in the graph palette), but it doesn't do what I want - I'm not trying to display a subset of the data, I'm trying to display all the data with modified axis labels.  The actual x-values are pretty meaningless on their own (will vary with the zoom level of the camera, among other things)..
Message Edited by Siwa on 10-13-2009 10:33 AM
0 Kudos
Message 5 of 5
(3,291 Views)