Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Object: esri/renderers/smartMapping

require(["esri/renderers/smartMapping"], function(smartMapping) { /* code goes here */ });

Description

(Added at v3.13)
This module contains a collection of helper functions used to create pre-configured renderers for smart feature styling.

More information on working with rendering, smart mapping, and using visual variables can be found in the Data Visualization guide topic and the multiple samples referenced within this topic.

Samples

Search for samples that use this class.

Methods

NameReturn typeSummary
createClassedColorRenderer(params)PromiseCreates a renderer for visualizing features using colors.
createClassedSizeRenderer(params)PromiseCreates a renderer for visualizing features by varying their size.
createColorInfo(params)PromiseCreates an object defining a color ramp used to render a layer.
createColorRenderer(params)PromiseCreates a renderer for visualizing features using colors.
createHeatmapRenderer(params)PromiseCreates a renderer for visualizing features using heatmap.
createOpacityInfo(params)PromiseCreates an object that describes how opacity of features is calculated.
createPredominanceRenderer(params)PromiseCreates a renderer for identifying features by their color.
createSizeInfo(params)PromiseDefines the size of the symbol where feature size is proportional to data value.
createSizeRenderer(params)PromiseCreates a renderer for visualizing features by varying their size based on data.
createTypeRenderer(params)PromiseCreates a renderer for visualizing features by their type.
getSuggestedField(params)PromiseSearches the fields of an input layer or array of field objects for field names commonly used in rendering based on usage (e.g., RANK, TOTAL, AVERAGE, NAME, etc).
Method Details

createClassedColorRenderer(params)

Creates a renderer for visualizing features using colors. Features are categorized into multiple classes based on a data attribute (Example: population), and each class is assigned a specific color. All features that belong to a certain class are drawn with the same color. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> classificationMethod Optional Indicates the classification method used to create class breaks. The following methods are supported: equal-interval, natural-breaks, quantile and standard-deviation. Default is equal-interval.
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Object> legendOptions Optional An object providing options for displaying the color ramp in the legend. See the object specification table for legendOptions below.
<String> normalizationField Optional Name of the attribute field used to normalize the data. Applicable only when normalizationType is field.
<String> normalizationType Optional Indicates how data values are normalized. The following types are supported: field, log, percent-of-total. When normalized using a field, you need to specify normalizationField.
<Number> numClasses Optional Number of class breaks needed. Ignored when classificationMethod is standard-deviation. Default is 5.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/choropleth.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Boolean> showOthers Optional Indicates whether the renderer should display features that don't have any value for the specified field or features that do not fall within any of the class breaks. Default is true.
<Number> standardDeviationInterval Optional Standard deviation interval. The following values are supported: 1, 0.5, 0.33 and 0.25. Applicable only when classificationMethod is standard-deviation.
<String> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding color ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Object[]> classBreakInfos An array of objects each describing a class break. Each object will have the following properties: minValue, maxValue.
<Number> maxValue Maximum value used for class breaks.
<Number> minValue Minimum value used for class breaks.
<Number> normalizationTotal Sum of all data values used to normalize data. Available only when normalizationType is percent-of-total.
<Boolean> partialData Indicates that statistics were generated for a subset, or sampling, of features on the client rather than queried against the service.
<Renderer> renderer A pre-configured ClassBreaksRenderer. Use FeatureLayer.setRenderer to apply this renderer to a layer.
<Object> statistics Field statistics (min, max, avg, stddev) used to create the renderer.
<legendOptions>
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding color ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createClassedSizeRenderer(params)

Creates a renderer for visualizing features by varying their size. Features are categorized into multiple classes based on a data attribute (Example: population), and each class is assigned a specific symbol size. All features that belong to a certain class are drawn with the same size. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> classificationMethod Optional Indicates the classification method used to create class breaks. The following methods are supported: equal-interval, natural-breaks, quantile and standard-deviation. Default is equal-interval.
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Object> legendOptions Optional An object providing options for displaying the size ramp in the legend. See the object specification table for legendOptions below.
<String> normalizationField Optional Name of the attribute field used to normalize the data. Applicable only when normalizationType is field.
<String> normalizationType Optional Indicates how data values are normalized. The following types are supported: field, log, percent-of-total. When normalized using a field, you need to specify normalizationField.
<Number> numClasses Optional Number of class breaks needed. Ignored when classificationMethod is standard-deviation. Default is 5.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/size.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Boolean> showOthers Optional Indicates whether the renderer should display features that don't have any value for the specified field or features that do not fall within any of the class breaks. Default is true.
<Number> standardDeviationInterval Optional Standard deviation interval. The following values are supported: 1, 0.5, 0.33 and 0.25. Applicable only when classificationMethod is standard-deviation.
<String> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding size ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Object[]> classBreakInfos An array of objects each describing a class break. Each object will have the following properties: minValue, maxValue.
<Number> maxValue Maximum value used for class breaks.
<Number> minValue Minimum value used for class breaks.
<Number> normalizationTotal Sum of all data values used to normalize data. Available only when normalizationType is percent-of-total.
<Boolean> partialData Indicates that statistics were generated for a subset, or sampling, of features on the client rather than queried against the service.
<Renderer> renderer A pre-configured ClassBreaksRenderer. Use FeatureLayer.setRenderer to apply this renderer to a layer.
<Object> statistics Field statistics (min, max, avg, stddev) used to create the renderer.
<legendOptions>
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding size ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createColorInfo(params)

Creates an object defining a color ramp used to render a layer. See the Object Specifications table below for the structure of the params object and Promise. (Added at v3.15)
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which the colorInfo is created.
<Object> legendOptions Optional An object providing options for displaying the color ramp in the legend. See the object specification table for legendOptions below.
<String> normalizationField Optional Name of the feature attribute field by which the data value will be normalized.
<Object> scheme Optional An object describing the style scheme used for the colorInfo. A style scheme can be obtained by calling esri/styles/choropleth.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<String> sqlExpression Optional A SQL expression evaluating to a number. When a sqlExpression is provided, an equivalent valueExpression is required. The logic of the valueExpression must match the logic of the sqlExpression.
<String> sqlWhere Optional A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization.
<String> theme Optional Theme to be used. The following themes are supported: high-to-low, above-and-below, centered-on, or extremes. Default is high-to-low.
<String> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding color ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Object> colorInfo An object defining a color ramp used to render the layer. See Renderer.colorInfo for additional information on the object properties.
<Object> scheme An object describing the style scheme used for the colorInfo. This is the same scheme returned from esri/styles/choropleth.getSchemes.
<Object> statistics See return value from FeatureLayerStatistics.getFieldStatistics for additional information on the object properties.
<legendOptions>
<Boolean> showLegend Optional Indicates whether to show the color ramp in the legend.
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding color ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createColorRenderer(params)

Creates a renderer for visualizing features using colors. Colors are picked from a color gradient by mapping a feature's data attribute (Example: population) to a specific color in the gradient. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Object> legendOptions Optional An object providing options for displaying the color ramp in the legend. See the object specification table for legendOptions below.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/choropleth.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Boolean> showOthers Optional Indicates whether the renderer should display features that don't have any value for the specified field. Default is true.
<String> sqlExpression Optional A SQL expression evaluating to a number. When a sqlExpression is provided, an equivalent valueExpression is required. The logic of the valueExpression must match the logic of the sqlExpression.
<String> sqlWhere Optional A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization.
<Object> statistics Optional Field statistics (min, max, avg, stddev) used to create the renderer. If not provided, FeatureLayerStatistics.getFieldStatistics will be used to calculate the statistics.
<String> theme Optional Theme to be used. The following themes are supported: high-to-low, above-and-below, centered-on, and extremes. Default is high-to-low.
<String> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding color ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Renderer> renderer A pre-configured ClassBreaksRenderer with a visual variable for colorInfo. Use FeatureLayer.setRenderer to apply this renderer to a layer.
<Object> statistics Field statistics (min, max, avg, stddev) used to create the renderer.
<legendOptions>
<Boolean> showLegend Optional Indicates whether to show the color ramp in the legend.
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding color ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createHeatmapRenderer(params)

Creates a renderer for visualizing features using heatmap. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<Number> blurRadius Optional Radius (in pixels) around each point over which the majority of the intensity value calculated for that point is spread out. Default is 10.
<Boolean> fadeToTransparent Optional Indicates whether heat boundaries smooth out. Default is true.
<String> field Optional Name of the attribute field used to calculate the weighted intensity of each point. When an attribute field is not specified, each point will have the same intensity value.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Number> maxRatio Optional Pixel intensity ratio to which the last color in the scheme is associated with. All pixels with intensity greater than maxRatio will be displayed with the last color. It is a number between 0 and 1. Default is 1.
<Number> minRatio Optional Pixel intensity ratio to which the first color in the scheme is associated with. If fadeToTransparent is true, all pixels with intensity less than minRatio will fade away smoothly. Else, they will be displayed with the first color. It is a number between 0 and 1. Default is 0.01.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/heatmap.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Object> statistics Optional Statistics (min, max, avg, stddev) used to create the renderer. If not provided, FeatureLayerStatistics.getHeatmapStatistics will be used to calculate the statistics.
<Promise>
<Renderer> renderer A pre-configured HeatmapRenderer. Use FeatureLayer.setRenderer to apply this renderer to your layer.
<Object> statistics Field statistics (min, max, avg, stddev) used to create the renderer.

createOpacityInfo(params)

Creates an object that describes how opacity of features is calculated. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which the opacityInfo is created.
<Object> legendOptions Optional An object providing options for displaying the opacity ramp in the legend. See the object specification table for legendOptions below.
<String> normalizationField Optional Indicates how data values are normalized. The following types are supported: field, log, percent-of-total. When normalized using a field, you need to specify normalizationField.
<Boolean> useStdDev Optional Indicates whether to use standard deviation classification when creating the opacityInfo.
<String> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding opacity ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Object> statistics Field statistics (min, max, avg, stddev) used to create the renderer.
<legendOptions>
<Boolean> showLegend Optional Indicates whether to show the opacity ramp in the legend.
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding opacity ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createPredominanceRenderer(params)

Creates a renderer for identifying features by their color. A feature's color is calculated based on its predominant numeric attribute.

As of version 3.16, this method only works on hosted feature services. (Added at v3.15)
Return type: Promise
Parameters:
<Object> params Required See the Object Specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap. This is required unless scheme is used.
<Object[]> fields Required A list of up to five numeric attribute fields to include in the predominance calculation. The field that has the highest value for a feature will be designated as the predominant field for that feature.

It is an array of objects with two properties: name and label. label is optional. A maximum of five fields may be used for creating predominance renderers.
<Boolean> includeOpacityInfo Optional Indicates whether the renderer should calculate opacity of features based on the ratio of the predominant field to the sum of all fields. The higher the ratio, the more opaque the features. Default value is false.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/type.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Boolean> showOthers Optional Indicates whether the renderer should display features that do not have a value for any of the specified fields, or for features that have one or more fields with the same highest value. Default value is true.
<String> theme Optional Theme to be used. The following themes are supported: default. Default is default.
<Promise>
<Renderer> renderer A pre-configured UniqueValueRenderer. Use FeatureLayer.setRenderer to apply this renderer to a layer.
<Object> scheme This is the same as a scheme object returned by esri/styles/type.getSchemes method.

createSizeInfo(params)

Defines the size of the symbol where feature size is proportional to data value. See the Object Specifications table below for the structure of the params object and Promise. (Added at v3.15)
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which the colorInfo is created.
<Object> legendOptions Optional An object providing options for displaying the size ramp in the legend. See the object specification table for legendOptions below.
<String> normalizationField Optional Name of the feature attribute field by which the data value will be normalized.
<Boolean> optimizeForScale Optional Indicates whether to calculate the most optimal size range.
<Object> scheme Optional An object describing the style scheme used for the sizeInfo. A style scheme can be obtained by calling esri/styles/size.getSchemes method.
<string> sqlExpression Optional A SQL expression evaluating to a number. When a sqlExpression is provided, an equivalent valueExpression is required. The logic of the valueExpression must match the logic of the sqlExpression.
<string> sqlWhere Optional A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization.
<String> theme Optional Theme to be used. The following themes are supported: high-to-low, above-and-below, centered-on, and extremes. Default is high-to-low.
<string> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding size ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Object> scheme An object describing the style scheme used for the sizeInfo. This is the same scheme returned from esri/styles/size.getSchemes.
<Object> sizeInfo An object defining the size of the symbol where feature size is proportional to data value. See Renderer.sizeInfo for additional information on the object properties.
<Object> statistics See return value from FeatureLayerStatistics.getFieldStatistics for additional information on the object properties.
<legendOptions>
<Boolean> showLegend Optional Indicates whether to show the size ramp in the legend.
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding size ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createSizeRenderer(params)

Creates a renderer for visualizing features by varying their size based on data. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> field Required Name of the attribute field that contains data values.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Object> legendOptions Optional An object providing options for displaying the size ramp in the legend. See the object specification table for legendOptions below.
<Boolean | String> optimizeForScale Required Only applicable to polygon features. This parameter supports the following values:
  • "map-scale" or true: The size range is optimized only for the current map scale.
  • "visible-scale-range": Size range is optimized for all scales in the layer's visible scale range.
NOTE: Version 3.13 was slightly different in behavior as it only took a boolean with a default value of 'false'.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/size.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Boolean> showOthers Optional Indicates whether the renderer should display features that don't have any value for the specified field. Default is true.
<string> sqlExpression Optional A SQL expression evaluating to a number. When a sqlExpression is provided, an equivalent valueExpression is required. The logic of the valueExpression must match the logic of the sqlExpression.
<string> sqlWhere Optional A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization.
<Object> statistics Optional Field statistics (min, max, avg, stddev) used to create the renderer. If not provided, getFieldStatistics will be used to calculate the statistics.
<String> theme Optional Theme to be used. The following themes are supported: default. Default is default.
<string> valueExpression Optional An Arcade expression evaluating to a number. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding size ramp in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Renderer> renderer A pre-configured ClassBreaksRenderer with a visual variable for sideInfo. Use FeatureLayer.setRenderer to apply this renderer to a layer.
<Object> statistics Field statistics (min, max, avg, stddev) used to create the renderer.
<legendOptions>
<Boolean> showLegend Optional Indicates whether to show the size ramp in the legend.
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding size ramp in the Legend and takes precedence over the field alias or valueExpressionTitle.

createTypeRenderer(params)

Creates a renderer for visualizing features by their type. See the Object Specifications table below for the structure of the params object and Promise.
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for the structure of the params object.
Object Specifications:
<params>
<String> basemap Required Basemap used for your map. The following basemaps are supported: streets, gray, topo, terrain, national-geographic, oceans, osm, satellite, hybrid, dark-gray. If you're not using any of these basemaps, then pick one that closely resembles your basemap.
<String> field Required Name of the attribute field that contains uniquely identifiable type for every feature.
<FeatureLayer> layer Required Feature layer for which this renderer is created.
<Object> legendOptions Optional An object providing options for displaying the unique values table in the legend. See the object specification table for legendOptions below.
<Number> numTypes Optional Number of types displayed by the renderer. Use -1 to display all types. Default is 10.
<Object> scheme Optional An object describing the style scheme used for the renderer. A style scheme can be obtained by calling esri/styles/type.getSchemes method - either the primary scheme or a secondary scheme can be used. In the absence of scheme, both theme and basemap should be specified.
<Boolean> showOthers Optional Indicates whether the renderer should display features that don't have any value for the specified field or features that belong to types not displayed by the renderer. Default is true.
<String> theme Optional Theme to be used. The following themes are supported: default. Default is default.
<String> valueExpression Optional An Arcade expression evaluating to a number or a string. This expression can reference field values using the $feature global variable and perform mathematical calculations and logical evaluations at runtime. The values returned from this expression are the data used to drive the visualization. When a valueExpression is provided the field option is not needed.
<String> valueExpressionTitle Optional The title identifying and describing the associated Arcade expression as defined in the valueExpression property. This is displayed as the title of the corresponding unique values table in the Legend in the absence of a provided title in the legendOptions property.
<Promise>
<Number> othersStartIndex Index of uniqueValueInfos array that marks the beginning of types not displayed by the renderer. An index of -1 indicates that the renderer displays all types.
<Boolean> partialData Indicates that statistics were generated for a subset, or sampling, of features on the client rather than queried against the service.
<legendOptions>
<String> title Optional Text that describes the visualization. This is displayed as the title of the corresponding unique values table in the Legend and takes precedence over the field alias or valueExpressionTitle.

getSuggestedField(params)

Searches the fields of an input layer or array of field objects for field names commonly used in rendering based on usage (e.g., RANK, TOTAL, AVERAGE, NAME, etc). Numeric fields have a higher ranking than string fields. If no commonly used field name and no other useful field name can be found, then null is returned. Use this method to determine the field on which to base the renderer of a layer if the field names aren't known ahead of time. (Added at v3.16)
Return type: Promise
Parameters:
<Object> params Required See the object specifications table below for details about the params object.
Object Specifications:
<params>
<Field[]> fields Optional An array of fields from which to search and get the optimal field for rendering a layer. This property is required if the layer property is not used.
<Layer> layer Optional The layer from which to search and get the optimal field for rendering the layer. This property is required if the fields property is not used.
Sample:
require([
  "esri/layers/FeatureLayer", "esri/renderers/smartMapping", ... 
], function(FeatureLayer, smartMapping, ... ) {
  var fl = new FeatureLayer( ... );  //points to a Feature Service endpoint
  var params = { layer: fl };
  smartMapping.getSuggestedField(params).then(function(fieldName){
    var params = {
      basemap: "gray",
      field: fieldName,
      layer: fl
    };
    return params;
  }).then(function(rendererParams){
    smartMapping.createColorRenderer(rendererParams).then(function(response){
      fl.setRenderer(response.renderer);
      fl.redraw();
    });
  });
});