LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reference line on graph

Solved!
Go to solution

Hi All

I know this question has been asked before. I've done the searches and still can't get the attached vi to operate correctly

 

Would one of the LV knights look at the vi and tell me why the two constants on the BD (values 104 and 360) are not showing on the graph as reference lines. These two values are always fixed, and I want to see them as a reference line on the graph.

 

When you run the vi using the attached text file, look at the blue line beneath the second bar....what is this artifact?

 

I think that the last three bars are actually stacked atop each other with the largest masking the other two.

 

Thanks for any assistance

 

ray

Download All
0 Kudos
Message 1 of 9
(5,890 Views)

You code make little sense. Can you explain how it should look like?

 


rayclout wrote:

Would one of the LV knights look at the vi and tell me why the two constants on the BD (values 104 and 360) are not showing on the graph as reference lines. These two values are always fixed, and I want to see them


 

I don't see where you are drawing any "lines". Plot 2 only has two point [0;104] and [1;360] and the first point you change to [0;0] in your weird FOR loops. Two point define a single line, not "lines".

 

You only graph 2 plots:

 

  1. one with two points [0;10.34] and [1;0] showing as a blue bar graph
  2. one with two points [0;0] and [1;360] shwoing as yellow bar plot.
The line graph don't have any data, since your 2D array only has 2 rows, not 4.
So, please explain what you mean by "reference lines". It is not clear from your code.

 

0 Kudos
Message 2 of 9
(5,870 Views)
Solution
Accepted by topic author rayclout

Hi Ray,

 

I can see what you want but rather then modifying your code i have just written a small example of how it can be done. I have used and XY graph rather then a waveform chart like you where doing.

 

Hope this helps.

 

Rgs

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 3 of 9
(5,862 Views)

Thanks Lucither. You nailed it in one.

 

Great tip too about the order of the plot list.

 

I'm accepting that as the solution.

 

Best regards

Ray

0 Kudos
Message 4 of 9
(5,847 Views)

 

  • You don't need to generate data for the horizontal lines. Simply place two horizontal cursors.
  • If the x values are spaced linearly, there is no need for an xy graph. It just complicates the data structures for no additional benefit.

 

0 Kudos
Message 5 of 9
(5,842 Views)

Hi Ray,

 

Alt is right (Of course). You can just use cursors. I chose to use an xy graph as i was not sure whether you would actually need to enter specific values along the x axis (ie dates), which is easy to do on an xy graph. I have modified your original example to use cursors on your chart. Im assuming that the lines will be read from a file and as such you will not want the user to be able to move the cursors on the screen. If this is the case then what is a good example, i have disabled dragging for the cursor. If you will want to move the cursor on the screen then you will have to enable dragging. Enabling dragging on this example will give wierd results as on each iteration i am writing to the cursor value just to show you how its done.

 

Maybe this is closer to what you are after.

 

Regards,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 6 of 9
(5,834 Views)

The only problem i can see with using cursor for your limits rather then lines drawn on the graph is that if you want these lines to be permanent and not accessible to the user but at the same time have cursors that are used by the user then these lines will still come up on the cursor list, allowing the user to move them. If this is the case it may be better to just plot them on.

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 7 of 9
(5,833 Views)

 


@Lucither wrote:

The only problem i can see with using cursor for your limits rather then lines drawn on the graph is that if you want these lines to be permanent and not accessible to the user but at the same time have cursors that are used by the user then these lines will still come up on the cursor list, allowing the user to move them. If this is the case it may be better to just plot them on.


For each cursor you can define if it can be moved manually or not. You could use muted colors for the fixed cursors and bright colors and different style for the moveable cursors, for example.

 

0 Kudos
Message 8 of 9
(5,818 Views)

The problem i was highlighting was that if you wanted to use the 'Cursor Legend' so that a user can add cursors, the cursors that we have drawn on also appear on this list. Even if you have disabled dragging for these you can still move them by selecting them on the list and using the Cursor Legend up/down/left/right button. I was just pointing out that if this is undesirable then using cursors for these attributes may not be ideal. If the limits are a fixed value that are a constant on the graph it may be better to draw them on when loading the graph, this way it is guaranteed that the user cannot modify them. 

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 9 of 9
(5,813 Views)