From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display partial data graph with numeric control and cursor!

Hello,

I have problem to fit the ida to use numeric control to fix partial data to show in another graph from data graph entry file.

 

With numeric control it works ok. I fitted to no over range from data input.

 

I would like to can choose the data to show in the bottom graph with both controls and cursors, but I dont know the best way to get it. I tried but I only can get works it in both case separately.

 

Check vi attached I believe it shows clear the idea I want to get.

 

Any help would be great!.

 

Thanks for all guys.

Regards, Fred.

0 Kudos
Message 1 of 5
(2,465 Views)

Fred,

 

I think this may be what you have in mind. I separated the cursor moves from the Start/Length chnages by putting each into separate cases of an event structure. Both cases generate values for the start position and the length. I added Actual Start and Actual Length indicators to avoid the confusion which might result from changing the values of the controls. The start and length shift registers prevent XY Graph 2 from going blank when Stop is pressed.

 

Lynn

Message 2 of 5
(2,430 Views)

Hi Lynn,

 

First, thanks for your time!.

 

Yes, it is a possible solution. The example i attached it was from whole program where the vi is part of event structure with several cases.

 

It works but It would be fixed with the values of start and length of numeric control.

 

I believe i will use this mod vi I did. It looks works fine and I can add to the whole proyect without problems.

 

The only thing I would like to fix is the option of cursor 0 never will pass across cursor 1, so to let minimal 1 minute of data to the lowest range of data. Any idea?.

 

Best Regards and Thanks,

Fred.

 

0 Kudos
Message 3 of 5
(2,407 Views)

Fred,

 

I do not think you can prevent the user from dragging the cursors across each other. You can test for a minimum separation and force the cursor to a new position if the user drags it somewhere you do not want. This may be confusing to the user. An alternative is to use the cursor with the minimum value as the start position and just coerce Length to a 60 second minimum.

 

min cursor separation.png

 

I see some potential problems with your approach:

- Almost all the code for the graphs is duplicated. Anytime you need to make a change you must change it two places which means twice as many chances for errors.  This is why I had that code outside the event structure.

- The use of local variables and Value property nodes is discouraged. They break dataflow, can lead to race conditions, may require extra copies of the data, and are much slower than wires.  Shift registers can be your friend.

- There is no need to write to property nodes which never change. Setting RespToValOutLimits.Max and Min every time the loop iterates is not necessary. Write once before the loop starts.

- While not a problem here, it is generally not a good idea to put very much code inside event structures. Look at the Producer/Consumer Design Pattern for a better alternative.

- This kind of forcing of either the cursors or the Start and Length controls can be confusing to the users.  That is why I did not write to the controls or move the cursors programmatically.

 

Lynn

0 Kudos
Message 4 of 5
(2,394 Views)

Lynn,

 

Thank you for the advices.

I will try to use more shift register than use local variables and the rest of advices.

 

Yes, the system is a bit confuse. Maybe i will fit only with number control and maybe will try to add slider control.

 

Thank you and Regards.

Fred.

0 Kudos
Message 5 of 5
(2,362 Views)