I am using ArcGIS JavaScript API 4.12 version.
I would like to initialize UniqueValue renderer with 3 fields. But .createRenderer supporting only one field.
// visualization based on categorical field
var typeParams = {
layer: layer,
basemap: map.basemap,
field: "Party"
// field2: "State", // it is not supporting
// field3: "County" // it is not supporting
};
// when the promise resolves, apply the visual variables to the renderer
typeRendererCreator.createRenderer(typeParams)
.then(function(response){
layer.renderer = response.renderer;
});
Any advise please.
Solved! Go to Solution.
Hi Sirish,
The example given above can be accomplished using an Arcade Expression, but I'm not sure it gives a useful result because our color schemes contain a maximum of 10 colors for unique values before the colors start repeating, and if you accept the default max number of types of 10, then you will potentially get a lot of values that don't belong to a category.
The Arcade expression is:
var fields = [ $feature.DOM_CROP_ACRES, $feature.STATE, $feature.COUNTY]
Concatenate(fields, ", ");
Here's an app that demonstrates this: https://codepen.io/kekenes/pen/qBWRMGR?&editable=true&editors=100
Hi Sirish Byreddy,
Isn't it just the case that you want to have 3 different renderers? One for party, one for state, one for county?
In that case you will have to repeat your code three times.
Please let me know what you think.
Egge-Jan
Hi Egge-Jan,
I want to create one Unique renderer with 3 fields.
Thanks
S B
Hi Sirish,
The example given above can be accomplished using an Arcade Expression, but I'm not sure it gives a useful result because our color schemes contain a maximum of 10 colors for unique values before the colors start repeating, and if you accept the default max number of types of 10, then you will potentially get a lot of values that don't belong to a category.
The Arcade expression is:
var fields = [ $feature.DOM_CROP_ACRES, $feature.STATE, $feature.COUNTY]
Concatenate(fields, ", ");
Here's an app that demonstrates this: https://codepen.io/kekenes/pen/qBWRMGR?&editable=true&editors=100
Hi Kristian Ekenes,
Thank you very much for the help and i am getting Uniuevalues for multiple fields.
Correct it is giving only 10 colors and im trying to assign each unique value feature with unique color (between user choosen "from color" and "to color" ex: AlgorithmicColorRamp)
Appreciate any hints on the colorramp.
Thanks
S B
Yeah, that's what I thought: if you concatenate the three values Party/State/County, then every county should get a unique color. So, I supposed that you wanted to visualize either the party or the state or the county...
E-J