ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / UniqueValueRendererDefinition Class / ValuesLimit Property
Example

In This Topic
    ValuesLimit Property
    In This Topic
    Gets or sets a limit on how many unique values will be retrieved from the table.
    Syntax
    public int ValuesLimit {get; set;}
    Public Property ValuesLimit As Integer
    Remarks
    You can pass 0 to retrieve all unique values. By default it is set to 100.
    When you set it to other than 0, you should set DefaultSymbol and UseDefaultSymbol so that you will miss any features from drawing.
    Example
    Use Arcade expression to create Class Breaks
    {
      var usaStatesLayer = map.GetLayersAsFlattenedList().OfType<FeatureLayer>()
                     .FirstOrDefault(fl => fl.Name == "USA States");
      if (usaStatesLayer == null)
      {
        return;
      }
    
      await QueuedTask.Run(() =>
      {
      //Create a color ramp from red to blue
      var colorRampForPopulation = ColorFactory.Instance.ConstructColorRamp(
            ColorRampAlgorithm.LinearContinuous,
            ColorFactory.Instance.RedRGB, ColorFactory.Instance.BlueRGB);
    
      //This Arcade expression categorizes the POP2000 field in the usaStates layer
      //into Low, Medium, and High values
      var arcade = @"if ($feature.POP2000 < 1000000)
                       {return ""Low"";}" +
                   @"else if ($feature.POP2000 >= 100000 && $feature.POP2000 < 5000000)
                      {return ""Medium""; }" +
                    @"else if ($feature.POP2000 >= 5000000)
                      {return ""High"";}" +
                    @"else{return ""NA"";}";
      //Create the Arcade expression info
      CIMExpressionInfo arcadeExp = new CIMExpressionInfo();
      arcadeExp.Expression = arcade;
      arcadeExp.ReturnType = ExpressionReturnType.Default;
      arcadeExp.Title = "State Population Categorized";
      arcadeExp.Name = "USA States Population 2000";
    
      //Each population category is assigned a color from the color ramp and symbolized on the map
      // using a unique value renderer
      var uvr_desc = new UniqueValueRendererDefinition()
      {
        //ValueFields = new List<string> { "STATION" },
        ColorRamp = colorRampForPopulation,
        UseDefaultSymbol = true,
        ValuesLimit = 100,
        ArcadeExpression = arcadeExp.Expression
      };
      //Create the renderer and assign it to the layer
      var renderer = usaStatesLayer.CreateRenderer(uvr_desc);
      usaStatesLayer.SetRenderer(renderer);
      });
    }
    Defining a unique value renderer definition
    {
      await QueuedTask.Run(() =>
      {
        streamLayer = null;
        //https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer
    
        var uvrDef = new UniqueValueRendererDefinition()
        {
          ValueFields = new List<string> { "ACTYPE" },
          SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol(
            ColorFactory.Instance.RedRGB, 10, SimpleMarkerStyle.Hexagon)
              .MakeSymbolReference(),
          ValuesLimit = 5
        };
        //Note: CreateRenderer can only create value classes based on
        //the current events it has received
        streamLayer.SetRenderer(streamLayer.CreateRenderer(uvrDef));
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also