取消
显示结果 
搜索替代 
您的意思是: 

How to programmatically clear annotations on a graph?

已解决!
转到解答

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.

下载全部
0 项奖励
1 条消息(共 10 条)
6,241 次查看

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)

2 条消息(共 10 条)
6,232 次查看

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 项奖励
3 条消息(共 10 条)
6,220 次查看

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. 🙂

4 条消息(共 10 条)
6,197 次查看

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!

0 项奖励
5 条消息(共 10 条)
6,166 次查看
解答
接受人 LV_fun
6 条消息(共 10 条)
6,157 次查看

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 !  :高兴表情

0 项奖励
7 条消息(共 10 条)
6,139 次查看

LV_fun wrote:

Really appreciate your kind help !  :高兴表情


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

8 条消息(共 10 条)
6,135 次查看
Done.  Accidentally given kudos to you, too.
9 条消息(共 10 条)
6,119 次查看

Accidentally given kudos to you, too.

Lol... 极度高兴的表情 Thanks a lot 眨眼表情

10 条消息(共 10 条)
6,090 次查看