Please enable JavaScript to view this site.

IBM® SPSS® Amos™ 28

Navigation: Programming with Amos > Additional Programming Examples > Examples using the Amos Graphics classes

Use the Amos Graphics classes to draw double-headed arrows

Scroll Prev Top Next More

The following Amos Graphics plugin draws double-headed arrows among the selected exogenous variables. (Use 392 or 412 beforehand to select the exogenous variables that you want to be correlated.)

Imports Microsoft.VisualBasic
Imports Amos
Imports AmosEngineLib.AmosEngine.TMatrixID
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
    Implements IPlugin
 
    Public Function Mainsub() As Integer Implements IPlugin.Mainsub
        Dim SelectedEx As New Collection
        Dim x As PDElement
        Dim i As Integer
        Dim j As Integer
 
        'Construct the collection of selected, exogenous variables
        For Each x In pd.PDElements
            If x.IsSelected And x.IsExogenousVariable Then
                SelectedEx.Add(x)
            End If
        Next
 
        'Draw the double-headed arrows
        For i = 1 To SelectedEx.Count
            For j = i + 1 To SelectedEx.Count
                x = pd.DiagramDrawCovariance(SelectedEx(i), SelectedEx(j))
                x.IsSelected = True
            Next
        Next
 
        'Try to improve the appearance of the path diagram
        If SelectedEx.Count > 0 Then
            pd.EditTouchUp(SelectedEx(1))
            pd.EditTouchUp(SelectedEx(1))
        End If
 
        'The user will probably want to modify the curvature of the new
        'double-headed arrows.
        pd.EditShapeOfObject()
 
    End Function
 
    Public Function Name() As String Implements IPlugin.Name
    End Function
 
    Public Function Description() As String Implements IPlugin.Description
    End Function
End Class

© 2021 Amos Development Corporation