LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write Y-values on waveforms in graphs/charts

Hello,

 

As the question says, can I write the y-value of points on waveform in graphs/charts?

 

Thank you

0 Kudos
Message 1 of 4
(2,317 Views)

Hi Moobe,

 

You can write the value of the data point as an 'annotation' on a waveform graph.

Have a look at this link for some background reading...

http://zone.ni.com/reference/en-XX/help/371361G-01/lvhowto/adding_annotations_graphs/

 

For a quick guide to programmatically creating annotations...

1) Create a property node for the graph and select 'Annotation List'.

2) You can create an annotation array constant on the input to the property node (so long as it is set to write rather than read).

3) Each element in the array should include the details and setup for each text string that will be overlaid on the graph.

4) The main parameters you need to set for each annotation are 'Name', 'Position.X' and 'Position.Y'. It is also advisable to set a Label Offset value for X and Y so that the display is more readable.

 

I enclose a simple demonstration program that may help you.

 

Regards,

Dave.

Senior Software Engineer
www.Adansor.com
0 Kudos
Message 2 of 4
(2,310 Views)

Hello Dave,

 

Thanks for the reply.

Is it possible to do the same thing but with charts.

 

Thank you

0 Kudos
Message 3 of 4
(2,303 Views)

Hi Moobe,

 

I did look into using annotations on a chart but was unable to find a property for annotations. I don't think you can do this will a chart control.

You can however use a graph as a chart by manually adding a single data point on each loop iteration to an array of data that is used as the input to a graph.

image234.PNG

Just a few points on this...

Ensure that you control the size of the array. the example above is very very bad because the array of data has no size constraint. Charts by default store 1024 points of data so you would need to check when the array size reaches its maximum depth and then as you add new data in, remove the oldest data point. If you do put a size constraint in, it would be better to pre-initialise the array outside the loop with the required number of elements using initialise array.vi as opposed to a emtpy array constant. I would also use the replace array.vi rather that build array as its more efficient but you should hopefully get the picture.

 

I hope this helps,

Dave.

Senior Software Engineer
www.Adansor.com
Message 4 of 4
(2,280 Views)