ArcGIS Pro 3.3 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 static DiagramLayer AddDiagramLayer( 
       Map map,
       NetworkDiagram networkDiagram
    )
    Public Shared Function AddDiagramLayer( _
       ByVal map As Map, _
       ByVal networkDiagram As NetworkDiagram _
    ) As DiagramLayer

    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 (myDiagram)
    DiagramLayer diagramLayer = await QueuedTask.Run<DiagramLayer>(() =>
    {
      // Create the diagram map
      var newMap = MapFactory.Instance.CreateMap(myDiagram.Name, ArcGIS.Core.CIM.MapType.NetworkDiagram, MapViewingMode.Map);
      if (newMap == null)
        return null;
    
      // Open the diagram map
      var mapPane = ArcGIS.Desktop.Core.ProApp.Panes.CreateMapPaneAsync(newMap, MapViewingMode.Map);
      if (mapPane == null)
        return null;
    
      //Add the diagram to the map
      return newMap.AddDiagramLayer(myDiagram);
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also