LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically clear annotations on a graph?

Solved!
Go to solution

Hello,

 

I wish to label certain peaks on the waveform graph upon finishing peak detection for the input signal.  Now I've programmatically annotated the graph (see fig 1). However,  the annotations stay there all the time (see fig 2). The annotations are supposed to disappear each time the vi is run and to appear only when the peak detection job is finished which is triggered by a push button.  

 

So may I know how to programmatically clear annotations on a graph?  Thank you in advance.

Download All
0 Kudos
Message 1 of 10
(6,059 Views)

You would simply wire an empty array (of the correct type) to the annotation list property.

 

("right-click the property...create constant" makes it easy to make the an empty array constant of the correct type)

Message 2 of 10
(6,050 Views)

Hi, altenbach

 

Thank you for your timely help. I tried your solution. However, since the annotations were initially mannually created from the shortcut menu of the graph (Data Operations»Create Annotation),  by assigning an empty array to the annotation list, the annotation list becomes empty and my codes cannot change the annotation attributes any more. Please refer to the snap shot of my codes.

 

Actually I need to create an annotation for each detected meaningful peaks stored in the 'detected peak array', with the name displayed as 'PK I, PK II, ... PK V',  but don't know how to programmatically create the annotations.  Can you advise or provide some example codes?  Thanks.

0 Kudos
Message 3 of 10
(6,038 Views)

The annotation list is an array of annotations. In your example, it is kept in a shift register.

 

To delete annotations, you delete certain array elements, to delete all annotations, you make it an empty array, and to add new annotations, you add new elements to the array.

 

Why don't you attach a simplified version of your code so we don't need to start coding an example from scratch. 🙂

Message 4 of 10
(6,015 Views)

Sure. I've enclosed the simplied codes by mannully storing the information of the detected peaks into an array. The input data file is also provided.

 

The vi is supposed to annotate the peaks upon user pressing down the Start Automatic Labelling button instead of showing the annotations all the way.  I look forward to your kind help. Thank you!

Download All
0 Kudos
Message 5 of 10
(5,984 Views)
Solution
Accepted by topic author LV_fun
Message 6 of 10
(5,975 Views)

Hi, altenbach

 

I modified my codes by referring to yours, and now it works exactly in the way that I want. Thank you so much for teaching me on this. Really appreciate your kind help !  :Smiley Happy

0 Kudos
Message 7 of 10
(5,957 Views)

LV_fun wrote:

Really appreciate your kind help !  :Smiley Happy


Appreciate by giving some kudos to him. Also please mark the post of Altenbach which you think is the best solution for your problem that will help others in the future facing same problem and looking for a solution.

 

thanks,

Mathan

Message 8 of 10
(5,953 Views)
Done.  Accidentally given kudos to you, too.
Message 9 of 10
(5,937 Views)

Accidentally given kudos to you, too.

Lol... Smiley Very Happy Thanks a lot Smiley Wink

Message 10 of 10
(5,908 Views)