LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Horizontal Lines on Graph

Hi everyone,

 

I am trying to find a way to create horizontal lines on my waveform graph. These horizontal lines will be placed at a user controlled number. In order to access the VI "Graph Band Markers" is the main VI and the other two VIs in the Finals folder are the subVIs. (I need to work on the organization structure, I know)

 

Inner Case Structure: 0, Default

The subVI controls this function: The user will enter a value on front panel for "Temperature Band Value Outlet" and that value needs to be added to "First Outlet Temperature (Water Heater Only)". The "First Outlet Temperature (Water Heater Only)" value comes from using the first call and recording the first value as a comparison value. These lines should output on the waveform graph labeled "Outlet Temperature Graph" and same with the Inlet Values respective to the "Inlet Temperature Graph"

 

Inner Case Structure: 1

The subVI controls this function: "Upper Limit Inlet Temp", "Upper Limit Outlet Temp", "Lower Limit Outlet Temp" and "Lower Limit Inlet Temp" are all user controls on the front panel. I need to output these as lines on the "Outlet Temperature Graph" and "Inlet Temperature Graph"

0 Kudos
Message 1 of 10
(3,521 Views)

Hi sam,

 


@sambpk wrote:

I am trying to find a way to create horizontal lines on my waveform graph. These horizontal lines will be placed at a user controlled number. In order to access the VI "Graph Band Markers" is the main VI and the other two VIs in the Finals folder are the subVIs. (I need to work on the organization structure, I know)

You can get those "lines" quite easily:

  • add more plots (with constant data values) to show those lines
  • use cursors as lines
  • use the background image property of the graph to show lines

 

What is the reason to hide all those terminals in your block diagram far away from the rest of the code?

What is the reason to use locals, when those terminals are unused?

What is the reason to use references for most controls instead of reading just from the terminals?

You really need to redesign your code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,507 Views)

@GerdW wrote:

Hi sam,

 


@sambpk wrote:

I am trying to find a way to create horizontal lines on my waveform graph. These horizontal lines will be placed at a user controlled number. In order to access the VI "Graph Band Markers" is the main VI and the other two VIs in the Finals folder are the subVIs. (I need to work on the organization structure, I know)

You can get those "lines" quite easily:

  • add more plots (with constant data values) to show those lines
  • use cursors as lines
  • use the background image property of the graph to show lines

It is not a constant data value, it is controlled by the user. The user will enter a value on the front panel before the beginning of the test and then that user entered value will output on the graph. That's why I haven't used a constant value as this value will change, same with cursors as lines.

 

What is the reason to hide all those terminals in your block diagram far away from the rest of the code?

They are hidden because my boss would like them to not be on the front panel when not using this part of a larger test. It is a specification for my company and doesn't have anything to do with the lines on the graph.

What is the reason to use locals, when those terminals are unused?

The terminals are not unused. This is a large test and many of the loops require their own on and off switches, but the test type remains the same throughout therefore a local variable is used instead of having to select the test type 10 different times. 

What is the reason to use references for most controls instead of reading just from the terminals?

I need to use references because it is a very very large code and I would too many very very long wires going in and out of loops and all over the code, the variables are easier to wire.

You really need to redesign your code…

You cannot see my entire code, so i'm not sure how you can make this assumption based off one of the smaller suVIs within my code. You have no idea of the function of or reason why things are the way they are as you can't see the entire code. 


 

0 Kudos
Message 3 of 10
(3,487 Views)

Hi Sam,

 


@sambpk wrote:

You can get those "lines" quite easily:

  • add more plots (with constant data values) to show those lines
  • use cursors as lines
  • use the background image property of the graph to show lines

It is not a constant data value, it is controlled by the user. The user will enter a value on the front panel before the beginning of the test and then that user entered value will output on the graph. That's why I haven't used a constant value as this value will change, same with cursors as lines.

 

Then you don't get "horizontal lines" when the user can change this value.

But anyway: add one more plots to your graphs to show those "marker lines"…

 


@sambpk wrote:

You really need to redesign your code…

You cannot see my entire code, so i'm not sure how you can make this assumption based off one of the smaller suVIs within my code. You have no idea of the function of or reason why things are the way they are as you can't see the entire code. 



You didn't say so far this is just a small part of a "very very large" entire code…

But anyway: when even this small part is showing so many problems and with all the "excuses" you gave I still (or even more) recommend to refactor your code base!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(3,483 Views)

@GerdW wrote:

Hi Sam,

 


@sambpk wrote:

You can get those "lines" quite easily:

  • add more plots (with constant data values) to show those lines
  • use cursors as lines
  • use the background image property of the graph to show lines

It is not a constant data value, it is controlled by the user. The user will enter a value on the front panel before the beginning of the test and then that user entered value will output on the graph. That's why I haven't used a constant value as this value will change, same with cursors as lines.

 

Then you don't get "horizontal lines" when the user can change this value.

But anyway: add one more plots to your graphs to show those "marker lines"…

It is entered before the program begins. It is one set value the entire program, however the user has the option to change that value before the program begins. I cannot attach marker lines to a control value, I have already tried. 

 


@sambpk wrote:

You really need to redesign your code…

You cannot see my entire code, so i'm not sure how you can make this assumption based off one of the smaller suVIs within my code. You have no idea of the function of or reason why things are the way they are as you can't see the entire code. 



You didn't say so far this is just a small part of a "very very large" entire code…

But anyway: when even this small part is showing so many problems and with all the "excuses" you gave I still (or even more) recommend to refactor your code base!

All the "excuses" are specifications given to me by my boss, so I'm not sure why or what I would be changing. All these things you pointed out I was told to use, so you telling me to refactor doesn't really help me much at all as I can't because I am not the boss. 


 

0 Kudos
Message 5 of 10
(3,480 Views)

Hi Sam,

 


@sambpk wrote:

Then you don't get "horizontal lines" when the user can change this value.

But anyway: add one more plots to your graphs to show those "marker lines"…

It is entered before the program begins. It is one set value the entire program, however the user has the option to change that value before the program begins. I cannot attach marker lines to a control value, I have already tried.


You can easily add plots to a graph, just read the context help of the graphs to learn how…

 


@sambpk wrote:

But anyway: when even this small part is showing so many problems and with all the "excuses" you gave I still (or even more) recommend to refactor your code base!

All the "excuses" are specifications given to me by my boss, so I'm not sure why or what I would be changing. All these things you pointed out I was told to use, so you telling me to refactor doesn't really help me much at all as I can't because I am not the boss. 



When your boss forces you to create bad code and when you get paid for creating bad code, then surely you can keep going with this.

But you will get suggestions/recommendations to improve/refactor your code in the future, not just from me, but also from other volunteers in this forum…

(And please don't ask for help because of problems enforced by this bad code.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(3,477 Views)

@GerdW wrote:

Hi Sam,

 


@sambpk wrote:

Then you don't get "horizontal lines" when the user can change this value.

But anyway: add one more plots to your graphs to show those "marker lines"…

It is entered before the program begins. It is one set value the entire program, however the user has the option to change that value before the program begins. I cannot attach marker lines to a control value, I have already tried.


You can easily add plots to a graph, just read the context help of the graphs to learn how…

 


@sambpk wrote:

But anyway: when even this small part is showing so many problems and with all the "excuses" you gave I still (or even more) recommend to refactor your code base!

All the "excuses" are specifications given to me by my boss, so I'm not sure why or what I would be changing. All these things you pointed out I was told to use, so you telling me to refactor doesn't really help me much at all as I can't because I am not the boss. 



When your boss forces you to create bad code and when you get paid for creating bad code, then surely you can keep going with this.

But you will get suggestions/recommendations to improve/refactor your code in the future, not just from me, but also from other volunteers in this forum…

(And please don't ask for help because of problems enforced by this bad code.)


All I wanted to know was how to add lines to the graph, there's nothing wrong with my code otherwise. Everything works as expected even though it's "bad code". And I didn't ask any questions about anything else, I am not a computer science wizard I am in fact not even a computer science person. I genuinely hate this forum because no one ever wants to help, they just want to criticize everything that isn't exactly how they would have thought to do it. 

0 Kudos
Message 7 of 10
(3,473 Views)

Hi Sam,

 


@sambpk wrote:


You can easily add plots to a graph, just read the context help of the graphs to learn how…



All I wanted to know was how to add lines to the graph, there's nothing wrong with my code otherwise. …  I genuinely hate this forum because no one ever wants to help,


As I wrote before (more than once): just add another plot to your graphs!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(3,451 Views)
@sambpk wrote:

@GerdW wrote:

 

What is the reason to hide all those terminals in your block diagram far away from the rest of the code?

They are hidden because my boss would like them to not be on the front panel when not using this part of a larger test. It is a specification for my company and doesn't have anything to do with the lines on the graph.


GerdW was not referring to the front panel. Perhaps you are using the terminals in other parts of your code? We can't know that, and you had not stated prior to this that this was part of a larger program.

 

@sambpk wrote:


@GerdW wrote:

What is the reason to use locals, when those terminals are unused?

The terminals are not unused. This is a large test and many of the loops require their own on and off switches, but the test type remains the same throughout therefore a local variable is used instead of having to select the test type 10 different times. 

The normal way to do this is to use a wire. 

 

@sambpk wrote:


@GerdW wrote:

What is the reason to use references for most controls instead of reading just from the terminals?

I need to use references because it is a very very large code and I would too many very very long wires going in and out of loops and all over the code, the variables are easier to wire.

A very large code is an even greater reason to have a good architecture. A good architecture is designed so that you don't have "long wires going in and out of loops all over the code." 

 

@sambpk wrote:


All I wanted to know was how to add lines to the graph, there's nothing wrong with my code otherwise. Everything works as expected even though it's "bad code". And I didn't ask any questions about anything else, I am not a computer science wizard I am in fact not even a computer science person. I genuinely hate this forum because no one ever wants to help, they just want to criticize everything that isn't exactly how they would have thought to do it. 


GerdW has told you several times how to do this. Also, most everyone on this forum wants to help, but you have to be able to receive help. I have found that GerdW really does have a teacher's heart - he wants to help you to grow in your ability to use LabVIEW and he wants to help you to avoid costly mistakes. While your code may appear to "work as expected" now there is serious reason to believe that your programming approach will cause problems down the road. He is trying to help you see that. For instance, two years from now you might be sharing this code and saying, "this code was working as expected and then I upgraded to a new machine and it doesn't work. Can anyone help me find the problem?" The problem is race conditions caused by your use of local variables which has not yet presented itself. Many LabVIEW Developers are not computer scientists (I am not), but that doesn't mean that we don't need to learn how to use the tools that we're using. 

 

 

 

 

Message 9 of 10
(3,433 Views)
 
 

Horizontal Graph Lines.png

This is the technique we mean to create horizontal lines on a graph.  This creates lines at y values of 1 and 0 but you can put them anywhere.  I used array size so the lines would be the same length as my data (the random points).

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 10 of 10
(3,409 Views)