ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMChartHistogramSeries Class
Members Example

In This Topic
    CIMChartHistogramSeries Class
    In This Topic
    Provides access to members that control histogram series.
    Object Model
    CIMChartHistogramSeries ClassCIMChartHistogramSeries ClassCIMChartTextProperties ClassCIMChartLineSymbolProperties ClassCIMChartFillSymbolProperties ClassCIMChartHistogramSeries ClassCIMChartLineSymbolProperties ClassCIMChartLineSymbolProperties ClassCIMChartLineSymbolProperties Class
    Syntax
    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/v2/CIMCharts.md
    
    var lyrsHistogram = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>();
    var lyrHistogram = lyrsHistogram.First();
    var lyrDefHistogram = lyrHistogram.GetDefinition();
    
    // Get list names for fields of type Double
    var doubleFields = lyrHistogram.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}",
            },
            Series = new CIMChartSeries[]
            {
            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 defintion 
    lyrDefHistogram.Charts = allChartsHistogram.ToArray();
    lyrHistogram.SetDefinition(lyrDefHistogram);
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMChartSeries
             ArcGIS.Core.CIM.CIMChartHistogramSeries

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also