Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Annotations caption position

I am making an application with waveformgraphs with time on the x-axis and depth on th y-axis. I have added xyrangeannotations with a square shape. I can give the ranges in [mm] and [seconds], and give the correct axis in so that the annotations stay on the graph when panned. The problem comes when I want to add a caption in the center of the square. As far as I have understood I have to use the "CaptionAlignment"-parameter. I have to enter an allignment (which is compared to the graph, so "center" is not in the center of the annotation. I can also add a x, and y-parameter for an offset, but this is not in [mm] and [seconds], so they will vary when the graph is panned.  Here is the code:

 

 

                    al[(i / 2)] = (new NationalInstruments.UI.XYRangeAnnotation());
                    al[i / 2].ArrowVisible = false;
                    al[i / 2].CaptionVisible = true;
                    al[i / 2].RangeFillColor = System.Drawing.Color.Yellow;
                    al[i / 2].RangeFillStyle = FillStyle.VerticalGradient;
                    al[i / 2].RangeLineColor = Color.Black;
                    al[i / 2].XAxis = this.depthXAxis;
                    al[i / 2].XRange = new Range(new DateTime(10000 * li[i]), new DateTime(10000 * li[i + 1]));
                    al[i / 2].YAxis = this.depthYAxis;
                    al[i / 2].YRange = new Range(0, 2);//NationalInstruments.UI.Range(-51, -38);
                    al[i/2].Caption = Parser.ConvertFromSecsToTime((li[i+1]-li[i])/1000);
                    float x=(float)convertFromMsecsToMouse( (li[i+1]+li[i])/2);
                    float y=(float)(graph1.YAxes[0].Range.Maximum*graph1.Size.Height/graph1.YAxes[0].Range.Interval);
                    al[i / 2].CaptionAlignment = new NationalInstruments.UI.AnnotationCaptionAlignment(NationalInstruments.UI.BoundsAlignment.None,0,0);
 

0 Kudos
Message 1 of 1
(5,942 Views)