I've got something weird in my legend. It is showing "others" as a category when there is no such attribute in my field. I don't know where it comes from or how to get rid of it. The only values in my attribute field (OfficialQH) are 0 and 1, integers. The layer is symbolizing correctly and as I would expect, I just need to get "others" off my legend.
var qhRenderer = {
type: "unique-value",
field: "OfficialQH",
defaultSymbol: {type: "simple-fill"},
uniqueValueInfos: [{
value: 0,
symbol: {
type: "simple-fill",
color: [225, 225, 225],
outline: {
color: "black",
width: 1
}
},
label: "Not Quail Habitat"
},
{
value: 1,
symbol: {
type: "simple-fill",
color: "green",
outline: {
color: "black",
width: 1
}
},
label: "Quail Habitat"
}]
};
//Add the patches feature class to the map
var featureLayer = new FeatureLayer({
url: "https://www.quailcount.org/nbcigis/rest/services/HbMonitoringTest/Patches/MapServer/0",
outFields: ["*"],
popupTemplate: popupBox,
renderer: qhRenderer
});
map.add(featureLayer);
//Create a legend
var legend = new Legend({
view: view,
layerInfos: [{
layer: featureLayer,
title: "Quail Habitat Status"
}]
});
Solved! Go to Solution.
Will leave this up for others, but answered it a minute later. If you remove the "defaultSymbol" parameter it gets rids of "others". This makes sense the more I think about it as the defaultSymbol would be the catch all for anything you didn't specifically symbolize, so the category on the legend would be as vague as "others".
Will leave this up for others, but answered it a minute later. If you remove the "defaultSymbol" parameter it gets rids of "others". This makes sense the more I think about it as the defaultSymbol would be the catch all for anything you didn't specifically symbolize, so the category on the legend would be as vague as "others".
I hope this help others, the "others" label can be changed. All you have to do is update the defaultLabel
property of the UniqueValueRenderer class to whatever label you want it to be.