ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FieldDescription Class / Type Property
Example

In This Topic
    Type Property (FieldDescription)
    In This Topic
    Gets the type of a field.
    Syntax
    public FieldType Type {get;}
    Public ReadOnly Property Type As FieldType
    Example
    Create a histogram for every field of type Double
    {
      // For more information on the chart CIM specification:
      // https://github.com/Esri/cim-spec/blob/main/docs/v3/CIMCharts.md
    
      var lyrDefHistogram = featureLayer.GetDefinition();
    
      // Get list names for fields of type Double
      var doubleFields = featureLayer.GetFieldDescriptions().Where(f => f.Type == FieldType.Double).Select(f => f.Name);
    
      // Create list that will contain all histograms
      var histograms = new List<CIMChart>();
    
      // Create histogram for each Double field
      foreach (var field in doubleFields)
      {
        // Define histogram CIM properties
        var histogram = new CIMChart
        {
          Name = $"histogram_{field}",
          GeneralProperties = new CIMChartGeneralProperties
          {
            Title = $"Histogram for {field}",
            UseAutomaticTitle = false
          },
          Series =
            [
                  new CIMChartHistogramSeries {
                      UniqueName = "histogramSeries",
                      Name = $"histogram_{field}",
                      BinCount = 15,
                      // Specify the number field
                      Fields = new string[] { field },
                  }
            ]
        };
    
    
        histograms.Add(histogram);
      }
      ;
    
      // Add new chart to layer's existing list of charts (if any exist)
      var allChartsHistogram = (lyrDefHistogram == null) ? histograms : lyrDefHistogram.Charts.Concat(histograms);
      // Add CIM chart to layer definition
      lyrDefHistogram.Charts = allChartsHistogram.ToArray();
      featureLayer.SetDefinition(lyrDefHistogram);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also