Description
Class added v1.4. A unique value renderer symbolizes groups of graphics that have matching attributes. For more information about renderers, see
Symbolizing graphics with renderers.
Samples
Search for
samples that use this class.
Class hierarchy
esri.Renderer
|_ esri.renderer.UniqueValueRenderer
Constructor
| esri.renderer.UniqueValueRenderer(defaultSymbol, attributeField, attributeField2?, attributeField3?, fieldDelimeter?) |
Creates a new UniqueValueRenderer object. Typically features are rendered based on the unique values of one attribute field. However up to three fields can be combined to generate a unique value. For example, if two fields are used which store the values A and B; and X, Y, and Z respectively, then the unique values for the renderer can be A:X, A:Y, A:Z, B:X, B:Y and B:Z, assuming ":" is the field delimiter. |
Properties
| attributeField |
String
|
The name of the attribute field the renderer uses to match values against. |
| attributeField2 |
String
|
If needed, specify an additional attribute field the renderer uses to match values. |
| attributeField3 |
String
|
If needed, specify an additional attribute field the renderer uses to match values. |
| defaultLabel |
String
|
Label for the default symbol used to draw unspecified values. |
| fieldDelimiter |
String
|
String inserted between the values if multiple attribute fields are specified. |
| infos |
Object[]
|
Each element in the array is an object that provides information about the unique values associated with the renderer. The object has the following properties:
|
<String> value
|
The unique value.
|
|
<Symbol> symbol
|
The symbol used to display the value.
|
|
<String> label
|
Label for the symbol used to draw the value.
|
|
<String> description
|
Label for the symbol used to draw the value.
|
|
| values |
String[]
|
Deprecated at v2.0, use infos instead. An array of values defined for the renderer. |
Methods
| addValue(value or info, symbol?) |
none
|
Adds a unique value and symbol.You can provide the value and its associated symbol as individual arguments or as an info object. |
| removeValue(value) |
none
|
Removes a unique value. After making changes, you must refresh the graphic. |
Constructor Detail
esri.renderer.UniqueValueRenderer(defaultSymbol, attributeField, attributeField2?, attributeField3?, fieldDelimeter?)
Creates a new UniqueValueRenderer object. Typically features are rendered based on the unique values of one attribute field. However up to three fields can be combined to generate a unique value. For example, if two fields are used which store the values A and B; and X, Y, and Z respectively, then the unique values for the renderer can be A:X, A:Y, A:Z, B:X, B:Y and B:Z, assuming ":" is the field delimiter.
Parameters:
|
<Symbol>
defaultSymbol |
Required |
Default symbol for the renderer. This symbol is used for unmatched values.
|
|
<String>
attributeField |
Required |
Attribute field renderer uses to match values.
|
|
<String>
attributeField2 |
Optional |
If needed, specify an additional attribute field the renderer uses to match values.
|
|
<String>
attributeField3 |
Optional |
If needed, specify an additional attribute field the renderer uses to match values.
|
|
<String>
fieldDelimeter |
Optional |
String inserted between the values of different fields. Applicable only when more than one attribute field is specifed for the renderer.
|
Code snippets:
var renderer = new esri.renderer.UniqueValueRenderer(defaultSymbol, "SUB_REGION");
Properties Detail
The name of the attribute field the renderer uses to match values against.
If needed, specify an additional attribute field the renderer uses to match values. (As of v2.0)
If needed, specify an additional attribute field the renderer uses to match values. (As of v2.0)
Label for the default symbol used to draw unspecified values. (As of v2.0)
String inserted between the values if multiple attribute fields are specified. (As of v2.0)
Each element in the array is an object that provides information about the unique values associated with the renderer. The object has the following properties:
|
<String> value
|
The unique value.
|
|
<Symbol> symbol
|
The symbol used to display the value.
|
|
<String> label
|
Label for the symbol used to draw the value.
|
|
<String> description
|
Label for the symbol used to draw the value.
|
(As of v2.0)
Deprecated at v2.0, use infos instead. An array of values defined for the renderer.
Methods Detail
addValue(value or info, symbol?)
Adds a unique value and symbol.You can provide the value and its associated symbol as individual arguments or as an info object.
Return value: none
Input Parameters:
|
<String> value or info |
Required |
Value to match with. The value can be provided as individual arguments or as an info object with the following properties:
|
<String> value
|
The unique value.
|
|
<Symbol> symbol
|
The symbol used to display the value.
|
|
<String> label
|
Label for the symbol used to draw the value.
|
|
<String> description
|
Label for the symbol used to draw the value.
|
|
|
<Symbol> symbol |
Optional |
Symbol used for the value. |
Code snippets:
Specify the value and symbol as individual arguments.
renderer.addValue("KS", symbol);
Specify the symbol and value using the info object.
renderer.addValue({
value: "KS",
symbol: new esri.symbol.SimpleFillSymbol(),
label: "Kansas",
description: "The Sunflower State"
});
Removes a unique value. After making changes, you must refresh the graphic.
Return value: none
Input Parameters:
|
<String> value |
Required |
Value to remove. |