ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMChartScatterSeries Class
Members Example

In This Topic
    CIMChartScatterSeries Class
    In This Topic
    Provides access to members that control point chart series.
    Object Model
    CIMChartScatterSeries ClassCIMChartScatterSeries ClassCIMChartTextProperties ClassCIMChartScatterSeries ClassCIMChartMarkerSymbolProperties ClassCIMChartLineSymbolProperties Class
    Syntax
    Example
    Create a simple scatter plot
    // For more information on the chart CIM specification:
    // https://github.com/Esri/cim-spec/blob/main/docs/v3/CIMCharts.md
    
    // Define fields names used in chart parameters.
    const string xField = "minimum_nights";
    const string yField = "price";
    
    var lyrsScatter = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>();
    var lyrScatter = lyrsScatter.First();
    var lyrDefScatter = lyrScatter.GetDefinition();
    
    // Define scatter plot CIM properties
    var scatterPlot = new CIMChart
    {
        Name = "scatterPlot",
        GeneralProperties = new CIMChartGeneralProperties
        {
            Title = $"{xField} vs. {yField}",
        },
        Series = new CIMChartSeries[]
        {
        new CIMChartScatterSeries {
            UniqueName = "scatterPlotSeries",
            Name = "scatterPlotSeries",
            // Specify the X and Y field names
            Fields = new string[] { xField , yField },
            // Turn on trend line
            ShowTrendLine = true
        }
        }
    };
    
    // Add new chart to layer's existing list of charts (if any exist)
    var newChartsScatter = new CIMChart[] { scatterPlot };
    var allChartsScatter = (lyrDefScatter == null) ? newChartsScatter : lyrDefScatter.Charts.Concat(newChartsScatter);
    // Add CIM chart to layer defintion 
    lyrDefScatter.Charts = allChartsScatter.ToArray();
    lyrScatter.SetDefinition(lyrDefScatter);
    
    Inheritance Hierarchy

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

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also