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?
Solved! Go to Solution.
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.
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.
Ella, thanks for leaving this up. 7 years later it definitely helped me!