ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / PieChartRendererDefinition Class / FieldName Property
Example

In This Topic
    FieldName Property (PieChartRendererDefinition)
    In This Topic
    Gets and sets the field name to use in determining the overall size of the pie chart (per feature)
    Syntax
    public string FieldName {get; set;}
    Public Property FieldName As String
    Remarks
    Corresponds to SizeOption of PieChartSizeOptions.Field otherwise it is ignored. If FieldName is not specified for PieChartSizeOptions.Field then the first eligible field in the underlying dataset is used.
    Example
    Pie chart renderer for a feature layer
    /// <summary>
    /// Renders a feature layer using Pie chart symbols to represent data
    /// ![Pie chart renderer](https://ArcGIS.github.io/arcgis-pro-sdk/images/Renderers/pie-chart.png)
    /// </summary>
    {
      //Check feature layer name
      //Code works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data
      var featureLayer = activeMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(f => f.Name == "USDemographics");
      if (featureLayer == null)
      {
        MessageBox.Show("This renderer works with the USDemographics feature layer available with the ArcGIS Pro SDK Sample data", "Data missing");
      }
      await QueuedTask.Run(() =>
      {
        //Fields to use for the pie chart slices
        var chartFields = new List<string>
        {
              "WHITE10",
               "BLACK10",
               "AMERIND10",
               "ASIAN10",
               "HISPPOP10",
               "HAMERIND10",
               "HWHITE10",
               "HASIAN10",
               "HPACIFIC10",
               "HBLACK10",
                "HOTHRACE10"
        };
    
        PieChartRendererDefinition pieChartRendererDefn = new PieChartRendererDefinition()
        {
          ChartFields = chartFields,
          ColorRamp = colorRamp,
          SizeOption = PieChartSizeOptions.Field,
          FieldName = "BLACK10",
          FixedSize = 36.89,
          DisplayIn3D = true,
          ShowOutline = true,
          Orientation = PieChartOrientation.CounterClockwise,
        };
        //Creates a "Renderer"
        var pieChartRenderer = featureLayer.CreateRenderer(pieChartRendererDefn);
    
        //Sets the renderer to the feature layer
        featureLayer.SetRenderer(pieChartRenderer);
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also