ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MappingExtensions Class / AddDiagramLayer Method
The map to add the diagram layer.
The diagram for which a diagram layer is created and added to the map.
Example

In This Topic
    AddDiagramLayer Method
    In This Topic
    Add a diagram layer to a diagram map.
    Syntax
    Public Shared Function AddDiagramLayer( _
       ByVal map As Map, _
       ByVal networkDiagram As NetworkDiagram _
    ) As DiagramLayer
    public static DiagramLayer AddDiagramLayer( 
       Map map,
       NetworkDiagram networkDiagram
    )

    Parameters

    map
    The map to add the diagram layer.
    networkDiagram
    The diagram for which a diagram layer is created and added to the map.

    Return Value

    The added diagram layer.
    Example
    Open a diagram pane from a Network Diagram
    {
      // Create a diagram layer from a NetworkDiagram
      static void CreateDiagramLayerFromNetworkDiagram(NetworkDiagram networkDiagram)
      {
        // Create the diagram map
        Map newMap = MapFactory.Instance.CreateMap(networkDiagram.Name, MapType.NetworkDiagram, MapViewingMode.Map);
    
        // Open the diagram map
        Task<IMapPane> mapPane = ProApp.Panes.CreateMapPaneAsync(newMap, MapViewingMode.Map);
    
        //Add the diagram to the map
        DiagramLayer diagramLayer = newMap.AddDiagramLayer(networkDiagram);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also