Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write on graph area

I am using measurement studio 7.1(Dotnet) and c#. I would like to know how to write some notes such as name of channels or the Delta time between the two cursors in left or right side of waveform plot. I included a snapshot of what I mean by left or right side of waveform plot. In this snapshot VA, VB are the channels name and those numbers in right side are the cursors positions.
0 Kudos
Message 1 of 3
(4,378 Views)
The easiest way to add text to the plot area of the graph is to use annotations, which is a new feature in Measurement Studio 7.1. To get started, check out the Annotations property of the graph. From the collection editor, you can add two kinds of annotations: point and range. In your case, it looks like you just want to display text, so I suggest that you try adding a point annotation, set the ArrowVisible and ShapeVisible properties to false, set the Caption property to the text that you want to display, then use the CaptionAlignment property to position the text.

For displaying a label for the cursor position, Measurement Studio 7.1 also added cursor labels. To display a cursor label, set the cursor's LabelVisible property to true, then you can confi
gure the cursor label with the LabelFont, LabelForeColor, LabelXFormat, and LabelYFormat properties.

- Elton
Message 2 of 3
(4,378 Views)
Thanks for response. I followed your advise regarding annotation. I added an array of XYPointAnnotation. So far so good. But I have problem to set yOffset in CaptionAlignment property. The yOffset is not a fix number. In run time I find out how many waveforms I need to plot as well as how many annotation. I start putting the first annotation from TopLeft but I don't know how to compute the yOffset for the next annotation. My solution to find out the yOffset and it fails is as follow:

xyPointAnnotation[visibleIndex].Caption = title;
xyPointAnnotation[visibleIndex].ArrowVisible = false;
xyPointAnnotation[visibleIndex].ShapeVisible = false;
interval = (numberOfVisibleAnalogChannels * factor) + numberOfVisibleDigitalChannels;
yOffset = Convert.ToInt32(Nati
onalInstruments.UI.BoundsAlignment.TopLeft) /interval * factor;
xyPointAnnotation[visibleIndex].CaptionAlignment = new NationalInstruments.UI.AnnotationCaptionAlignment(
NationalInstruments.UI.BoundsAlignment.TopLeft, 0F, yOffset );
0 Kudos
Message 3 of 3
(4,378 Views)