LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

adjust time scale in chart

Hi,

I am trying to write a VI that can adjust the time scale in a chart. Wired 2 number controls for the x.scale.max and x.scale.min. With only these two controls, the display flashes. Had to add another button control to only read the two number controls to be read once at a time. But the display still flashes back to 0 when updating, even briefly.

Wondering if there is an elegant way to control the time scale without the extra button or even a better way.

Also would love to know if there is a better way to control the y-scale.

Are there examples that illustrate controlling of x-scale and y-scale programmatically?

Please see the attache VI.

Thanks,

Rut.
0 Kudos
Message 1 of 12
(5,146 Views)

Make sure that autoscaling is OFF.

Property nodes for the graph can do all of that...

________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
0 Kudos
Message 2 of 12
(5,117 Views)
Autoscale is off. Still have the flashing problem.
0 Kudos
Message 3 of 12
(5,113 Views)
Right click on the chart and unselect Advanced>Auto Adjust Scales and see if that doesn't make a difference.
 
p.s. You would be better off using an event structure instead of case statements and if you were to use a Latch When Released mechanical action for the Booleans, you would have no need for the property nodes.
0 Kudos
Message 4 of 12
(5,104 Views)
Thanks for the replies.

To use the Event Structure, I have to make lots of changes on the real program. This VI is only a test on the scaling. The mechanic change did work better.

I de-selected the Auto Adjust Scales from Adavnced. But the flashing is still present.

The X Scale button is still needed. Without this button, ie, the X Scale.Range:Maximum and X Scale.Range:Minimum controls are directly connected to the corresponding properties, the display flashes all the time (please see the attached VI without this button; the previous VI has this button). With the button to ensure only one time control, the flash is short and acceptable.

My question is whether there is method that I don't need the X Scale button at all and only need to have some property combination that works properly. Or I have to live with it. Thanks.

Rut
0 Kudos
Message 5 of 12
(5,082 Views)

Hi Rut,

The main problem with what you have is that your graph is exceeding the range you have specified. In order to fix this you'll need to continually update the range of graph. But, the other thing is that you might want to try changing the update mode from Strip to Scope. You can change this by right clicking on the graph and selecting Advanced»Update Mode.

Regards,

Hillary E
National Instruments
0 Kudos
Message 6 of 12
(5,043 Views)
Hi Hillary,

Thanks for your reply. I now update the maximum value based upon the minimum value, ie, adding a number to the minimum and then using the result to update. See the attachment. But still keep the strip chart mode since I need it.

Rut
0 Kudos
Message 7 of 12
(5,020 Views)
Thanks for all the replies.

Now I am rewriting the whole program, putting the scaling functions in an Event Structure, and the DAQ portion in another While loop. The two-loops concept came after referencing the Producer/Consummer pattern from other threads. See the attached example.

I am not completely clear, but somehow the timed (with wait till ms) While loop has a higher priority over the other While loop that contains the Event Structure that handles user interface. Can someone explain the two loop concept and why it is better that putting everything in one loop and it is faster than one loop? Does it have anything to do with multithreading? Thanks,

Rut
0 Kudos
Message 8 of 12
(5,015 Views)

How do you mean that it has a higher priority?

Anything to do with graphics (such as changing values in a control) happens in the UI thread, regardless of where it is on your block diagram. Howeevr, having the seperate loops in your code does put tasks in seperates threads for processor sharing. SO the seperate tasks don't have to wait on the dataflow of others, therefore it is faster. Graphics tasks will always take longer than non-graphic tasks though because the UI thread is low priority.

Does that help?

________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
0 Kudos
Message 9 of 12
(5,011 Views)
By higher priority, I mean that in the 2 loop configuration the DAQ While loop seems not to be interrupted too much by the Event structure so that overwriting wouldn't happen to the data buffer. Or is it actually possible that the DAQ loop be interrupted so much by the Event loop that overwriting happens? Is the apparent 'higher priority' only acceived by the faster excution speed of 2 loop configuration, but not a real 'higher priority'? I thought the timing (wait till 100ms) had some priority control. Please correct me. Thanks.

Rut



Message Edited by Rut on 04-29-2008 10:31 AM
0 Kudos
Message 10 of 12
(5,007 Views)