unique value renderer for null values and all other values

2258
1
Jump to solution
05-18-2017 10:12 AM
EllaHaines
New Contributor III

I need to create a unique value renderer that shows null values as one symbol, and all other values as another (I don't want to list out each possible value when all that matters is that it isn't null). Here's what I've tried:

//set up unique value render for feature layer
//two kinds of symbols: segment comments and regular location comments
//--symbols
var commentSymbol = new SimpleMarkerSymbol({
   style: "round",
   color: "blue",
   size: "12px"
});
var segmentCommentSymbol = new SimpleMarkerSymbol({
   style: "round",
   color: "cyan",
   size: "12px"
});

//--renderer
var renderer = new UniqueValueRenderer({
   field: "SegmentId",
   defaultsymbol: segmentCommentSymbol
});
renderer.addUniqueValueInfo({
   value: null,
   symbol: commentSymbol
});

In the debugger it appears that the non-null segment graphics are being added properly to my graphics array for the feature layer. However, only the blue null values (for commentSymbol) are being displayed - the non-null value points are all missing from the map. What am I doing wrong?

1 Solution

Accepted Solutions
EllaHaines
New Contributor III

Oops, just realized it was a typo. It was supposed to be "defaultSymbol," not "defaultsymbol." I'll leave the question up as an example of how to do this, though, in case it's helpful to anyone else.

View solution in original post

1 Reply
EllaHaines
New Contributor III

Oops, just realized it was a typo. It was supposed to be "defaultSymbol," not "defaultsymbol." I'll leave the question up as an example of how to do this, though, in case it's helpful to anyone else.