Posted 5 March 2020, 6:47 am EST
Hello
Could you please help me to solve my problem.
I want to add annotations (text) through first loop and delete and then update annotations (text) to new values. I do not know how to delete or clear the annotations (text) created in the previous steps. I have attached a section of my code representing my problem.
Thank you very much.
C1.Win.Chart.Annotation.AnnotationLayer zBeamSecIdAnnotationLayer = new AnnotationLayer(flexChart1);
zBeamSecIdAnnotationLayer.Annotations.Clear();
C1.Win.Chart.Annotation.Text zbeamAnnoText = new Text();
for (int i = 0; i < Ns; i++) { for (int j = 0; j < Nb; j++) { if (zDisplayBeamSecName == true) { //zbeamAnnoText = new Text(); zbeamAnnoText.Content = zBeamSecId[Nb * i + j]; zbeamAnnoText.Attachment = AnnotationAttachment.DataCoordinate; zbeamAnnoText.Location = new PointF( (float)((XMainNodes[(i + 1) * (Nb + 1) + j] + XMainNodes[(i + 1) * (Nb + 1) + j + 1]) / 2), (float)((YMainNodes[(i + 1) * (Nb + 1) + j] + YMainNodes[(i + 1) * (Nb + 1) + j + 1]) / 2) + 200); zbeamAnnoText.Style.StrokeColor = Color.Cyan; zBeamSecIdAnnotationLayer.Annotations.Add(zbeamAnnoText); } else { zBeamSecIdAnnotationLayer.Annotations.Clear(); } } }