Hi, I have a 2D widget and a piece of code to get label to show.
The layer loads fine however the label isn't. Can anyone advise?
_getLabelClass: function () {
var labelSymbol = new TextSymbol();
var defaultPlacement = "above-center"
var json = {
"labelExpressionInfo": { "expression": "$feature.symbolname" },
"useCodedValues": false,
"labelPlacement": defaultPlacement
};
//create instance of LabelClass
var lc = new LabelClass(json);
lc.symbol = labelSymbol; // symbol also can be set in LabelClass' json
return lc;
},
layer = new FeatureLayer(layerSettings.url, options);
const layerInfoArr = [this._getLabelClass()];
layer.setLabelingInfo(layerInfoArr);
this.map.addLayer(layer);
Can you share a simplified version of the app that reproduces this issue? If you inspect the layer after it gets added to the map, is the label info in there? Are there any warnings or errors in the console? Have you considered using the 4x version of the ArcGIS API for JavaScript?
If this is in any way helpful, I recently ran into a similar issue.
https://maps.co.kendall.il.us/portal/home/item.html?id=5cdf287c15cb49c3b18d8f3811634781
Features don't render in any 3x maps, but appear in 4x maps. If it's relevant, the features were submitted via a Notebook using the Spatially Enabled DataFrame.