ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / GraduatedColorsRendererDefinition Class
Members Example

In This Topic
    GraduatedColorsRendererDefinition Class
    In This Topic
    Represents graduated color renderer definition to show qualitative differences in feature values with a range of color.
    Object Model
    GraduatedColorsRendererDefinition ClassCIMColorRamp ClassCIMSymbolReference ClassCIMSymbolReference ClassCIMSymbolReference Class
    Syntax
    public class GraduatedColorsRendererDefinition : ClassBreaksRendererDefinition 
    Public Class GraduatedColorsRendererDefinition 
       Inherits ClassBreaksRendererDefinition
    Remarks
    GraduatedColorsRendererDefinition class allow you to define parameters to create renderers to draw features with graduated color based on the values of a quantitative attribute that is statistically grouped by a classification algorithm.
    Once you define a graduated color renderer, you can call a FeatureLayer's CreateRenderer and SetRenderer methods to create and assign a renderer to a feature layer.
    Example
    Create a feature layer with class breaks renderer with defaults
    await QueuedTask.Run(() =>
    {
      var featureLayerCreationParams = new FeatureLayerCreationParams(new Uri(@"c:\data\countydata.gdb\counties"))
      {
        Name = "Population Density (sq mi) Year 2010",
        RendererDefinition = new GraduatedColorsRendererDefinition("POP10_SQMI")
      };
      LayerFactory.Instance.CreateLayer<FeatureLayer>(
        featureLayerCreationParams,
        MapView.Active.Map
      );
    });
    Create a feature layer with class breaks renderer
    string colorBrewerSchemesName = "ColorBrewer Schemes (RGB)";
    StyleProjectItem style = Project.Current.GetItems<StyleProjectItem>().First(s => s.Name == colorBrewerSchemesName);
    string colorRampName = "Greens (Continuous)";
    IList<ColorRampStyleItem> colorRampList = await QueuedTask.Run(() =>
    {
      return style.SearchColorRamps(colorRampName);
    });
    ColorRampStyleItem colorRamp = colorRampList[0];
    
    await QueuedTask.Run(() =>
    {
      GraduatedColorsRendererDefinition gcDef = new GraduatedColorsRendererDefinition()
      {
        ClassificationField = "CROP_ACR07",
        ClassificationMethod = ArcGIS.Core.CIM.ClassificationMethod.NaturalBreaks,
        BreakCount = 6,
        ColorRamp = colorRamp.ColorRamp,
        SymbolTemplate = SymbolFactory.Instance.ConstructPolygonSymbol(
                                ColorFactory.Instance.GreenRGB, SimpleFillStyle.Solid, null).MakeSymbolReference(),
        ExclusionClause = "CROP_ACR07 = -99",
        ExclusionSymbol = SymbolFactory.Instance.ConstructPolygonSymbol(
                                ColorFactory.Instance.RedRGB, SimpleFillStyle.Solid, null).MakeSymbolReference(),
        ExclusionLabel = "No yield",
      };
      var featureLayerCreationParams = new FeatureLayerCreationParams((new Uri(@"c:\Data\CountyData.gdb\Counties")))
      {
        Name = "Crop",
        RendererDefinition = gcDef
      };
      LayerFactory.Instance.CreateLayer<FeatureLayer>(featureLayerCreationParams, MapView.Active.Map);
    });
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Mapping.LayerDrawingDefinition
          ArcGIS.Desktop.Mapping.RendererDefinition
             ArcGIS.Desktop.Mapping.ClassBreaksRendererDefinition
                ArcGIS.Desktop.Mapping.GraduatedColorsRendererDefinition

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also