UniqueValueRenderer

868
1
08-11-2016 02:19 AM
MarkBalman
Occasional Contributor

Hi all

Using jsapi 4

Am now trying to symbolise some species polygons based on a field where a species distribution range is resident, breeding, non-breeding etc. I am passing a query into a graphic layer and can symbolise ranges using the following:

function getQueryResults(response) {

    var parcelResults = arrayUtils.map(response.features, function(feature) {

    feature.symbol = new SimpleFillSymbol({ 

            color: [255, 255, 0, 0.25], 

            style: "solid", 

            outline: { 

                color: [255, 255, 0], 

                width: 3 

            } 

        });

               

        return feature; 

    }); 

    return parcelResults; 

}

Obviously, this returns each species distribution part in yellow when what I want to do is use UniqueValueRenderer but cannot seem to get this to work here, any help/advice much appreciated.

0 Kudos
1 Reply
FC_Basson
MVP Regular Contributor

Hi Mark, have you looked at the example on this page: UniqueValueRenderer | API Reference | ArcGIS API for JavaScript 4.0

You need to define the renderer first, then apply it to the FeatureLayer.

0 Kudos