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

In This Topic
    CIMChartLineSeries Class
    In This Topic
    Provides access to members that control line series.
    Object Model
    CIMChartLineSeries ClassCIMChartLineSeries ClassCIMChartTextProperties ClassCIMChartLineSeries ClassCIMChartLineSymbolProperties ClassCIMChartMarkerSymbolProperties ClassTimeInstant Class
    Syntax
    Example
    Create a line chart with custom time binning and style
    // For more information on the chart CIM specification:
    // https://github.com/Esri/cim-spec/blob/main/docs/v2/CIMCharts.md
    
    // Define fields names used in chart parameters.
    const string dateField = "last_review";
    const string numericField = "price";
    
    var lyrsLine = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>();
    var lyrLine = lyrsLine.First();
    var lyrDefLine = lyrLine.GetDefinition();
    
    // Define line chart CIM properties
    var lineChart = new CIMChart
    {
        Name = "lineChart",
        GeneralProperties = new CIMChartGeneralProperties
        {
            Title = $"Line chart for {dateField} summarized by {numericField}",
        },
        Series = new CIMChartSeries[]
        {
        new CIMChartLineSeries {
            UniqueName = "lineChartSeries",
            Name = $"Sum({numericField})",
            // Specify date field and numeric field
            Fields = new string[] { dateField, numericField },
            // Specify aggregation type
            FieldAggregation = new string[] { string.Empty, "SUM" },
            // Specify custom time bin of 6 months
            TimeAggregationType = ChartTimeAggregationType.EqualIntervalsFromStartTime,
            TimeIntervalSize = 6.0,
            TimeIntervalUnits = esriTimeUnits.esriTimeUnitsMonths,
            // NOTE: When setting custom time binning, be sure to set CalculateAutomaticTimeInterval = false
            CalculateAutomaticTimeInterval = false,
            // Define custom line color
            ColorType = ChartColorType.CustomColor,
            LineSymbolProperties = new CIMChartLineSymbolProperties {
                Style = ChartLineDashStyle.DashDot,
                Color = new CIMRGBColor { R = 0, G = 150, B = 20 },
            }
        },
        }
    };
    
    // Add new chart to layer's existing list of charts (if any exist)
    var newChartsLine = new CIMChart[] { lineChart };
    var allChartsLine = (lyrDefLine == null) ? newChartsLine : lyrDefLine.Charts.Concat(newChartsLine);
    // Add CIM chart to layer defintion 
    lyrDefLine.Charts = allChartsLine.ToArray();
    lyrLine.SetDefinition(lyrDefLine);
    
    Inheritance Hierarchy

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

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also