LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Chart Zoom Question

I'm using a waveform chart to plot various data on two different charts.  However, I'd like to be able to come up with a control that would zoom in and out on the x-axis.  I know this control is available on the graph pallette and have seen it and tried using it, however for my application I'd like to, if possible, come up with a way to do this via zoom in and zoom out buttons on the front panel, much like those found in other computer programs.  It would be easier in my case to use the buttons if this would be able to be done.  If not, I can try to make the graph palette work.  Really I'd like to take that feature of zooming in/out and transfer it to a set of buttons.  I also know I've seen the zooming action like I want with pictures in various LV examples, but I'm using the chart.
 
I'm sure this would involve setting things via property nodes, but I wasn't having any luck with trying to adjust the x axis ranges with buttons I had come up with, it didn't work at all.  The buttons (zooming action) would effect both charts (although I was just trying to get things to work on one for the time being).  
 
I was hoping someone here could be of help to me on this.  Any examples or suggestions anyone could provide would be of great help. 
Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 1 of 11
(4,179 Views)
You could try something along the ideas in the attached VI (LabVIEW 7.0).
 
I am sure it will need a few tweaks, but I spend only a few minutes on it. Modify as needed. 🙂
0 Kudos
Message 2 of 11
(4,176 Views)
Thank you (once again!) Altenbach!  Just looking over your example and trying it out that seems to be pretty much what I would need, however I still have to try and put this in my program and try it out and whatnot, but at least this gives me something to go off of.
 
However, would you mind briefly explaining what is going on in the vi?  I don't quite follow exactly what you did.  I can see it working, but I think your explanation would help, if you don't mind.  i think that would help me not only in your vi, but why my original ideas didn't work.
 
Again, as always I appreciate your help.
 
 
Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 3 of 11
(4,169 Views)

Altenbach,

 

After looking over this a bit more, I have another question.  Is there a way to make the zoom in/out the same amount.  That is I would be able to zoom in say 25 points on the x-axis and then zoom out the same amount.  I thought I had modified your example to do this, but it doesn't seem to work afte rplaying with the numbers.

 

Any suggestions?

 

Thanks in advance...

 

 

Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 4 of 11
(4,148 Views)
0 Kudos
Message 5 of 11
(4,144 Views)

Thank you Altenbach!

Just a quick question again.  What is the purpose of the 5 constant wired to the "In Range and Coerce" function?  I have read over the help for the function, but I'm still a little confused over this.  I also had increased the chart history buffer as well, but my main concern was over the 5 and exactly what its purpose was at that input.  I've never used that function before, so that's why I'm asking.

Thank you again for your help....

 

 

Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 6 of 11
(4,137 Views)
This is just a fudge paramter to deal with edge effects and ensure that there is a good lower limit for the number of points displayed.
 
If you don't coerce, you might run into a situation where you are trying to set xmin=xmax or even xmin>xmax, both would make little sense. :)It would probably also make little sense to try to display more points than contained in the chart history, thus the upper limit.
0 Kudos
Message 7 of 11
(4,129 Views)

Thanks for the explanation Altenbach.

Just another quest or concern I'm playing around with, although everything works just about the way I want it to.  Do you have any suggestions on how to prevent the x-axis (min) from displaying or going to negative values?  My x-axis right now should only be positive numbers since the numbers there represent measurement numbers.  I had placed an absolute value function in front of the x min input to prevent this and it just about works, although I've noticed sometimes it will cause "zoom in"  instead of zooming out or not at all.  I don't really think that situation would come up in reality, but I'd like to try take care of it.  

I was just wondering if you had any ideas or suggestions.  I'm still working on it myself, but I thought I'd see what you thought if you had the time to answer.

Thanks again...  

Using Labview 7.0 and 2010 SP1 with Windows XP and 7.
0 Kudos
Message 8 of 11
(4,118 Views)
Hello,
 
In my case,I would like to be able to zoom on the chart to see previous values.
The problem is that when I uncheck "Autoscale X" and "Autocheck Y" I can zoom with the tool, but when a new value arrives in the chart (a new value comes every 10s) the X scale in the zoom moves.
 
To sum up, I just want the chart to stay still when I zoom, and to become normal again when I check "autoscale"
 
If someone has an idea...
Thanks
0 Kudos
Message 9 of 11
(4,018 Views)

Hello Dennis,

 

Thank you for posting your question to the NI discussion forums.  To answer your question, there is no built-in way to do what you are looking for – though feel free to request it.  However, you are able to program the desired behavior with use of some LabVIEW property nodes and a few of the built in structures of LabVIEW.

 

Basically, you want to know when the user has zoomed into an area and then, by using property nodes, ‘freeze’ the X and Y scales.  When the user presses some “ok” button, the program will re-autoscale and continue.

 

A colleague and I took a little interest in the problem and created an example program that hopefully you will be able to use.

 

I hope this helps, please let us know if you have any questions.

Message Edited by Travis M. on 07-26-2006 10:09 AM

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 10 of 11
(3,998 Views)