Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control flotating annotation arrow length

Hi,
I want to add a floating annotation to the graph. The annotation's style is 'Text with an arrow'. The annotation's position on the graph is controlled by axes coordinates. As the annotation is added to the plot, its arrow is pointed towards zero. How do I control this behaviour?
I am attaching the test code.

Dim DataX(100) As Single
Dim DataY(100) As Single


Private Sub Command1_Click()
Dim Test_Note As CWAnnotation
Set Test_Note = CWGraph1.Annotations.Add
Test_Note.CoordinateType = cwAxesCoordinates
Test_Note.SnapMode = cwCSnapFloating
Test_Note.Caption.Text = "test"
Test_Note.Caption.XCoordinate = (CWGraph1.Axes(1).Maximum + CWGraph1.Axes(1).Minimum) / 2
Test_Note.Caption.YCoordinate = (CWGr
aph1.Axes(2).Maximum + CWGraph1.Axes(2).Minimum) / 2
End Sub

Private Sub Form_Load()
Dim i%
For i = LBound(DataX) To UBound(DataX)
DataX(i) = i
DataY(i) = Sin(i) * 100
Next
CWGraph1.PlotXvsY DataX, DataY
End Sub


Thanks in advance.

Pradyumna
0 Kudos
Message 1 of 2
(5,835 Views)
You can change where the arrow points by setting the XCoordinates and YCoordinates properties of the shape. Since the type of the shape is cwShapeNone, single values for these properties will specify the coordinate of the arrow tail. For example, add this code at the bottom of the Command1_Click method:

Test_Note.Shape.Type = cwShapeNone
Test_Note.Shape.XCoordinates = 20
Test_Note.Shape.YCoordinates = 20

- Elton
Message 2 of 2
(5,835 Views)