I am adding a TextSymbol renderer to a feaure layer, but I cannot figure out how to make the text dynamic and pull from an attribute. All the examples I found show static text.
this.motoLayer = new FeatureLayer({
url: this.layerURL,
outFields: ["*"],
popupTemplate: this.motoTemplate,
popupEnabled: true,
labelingInfo: this.motoLabel,
labelsVisible: true
});
var symbol = {
type: "text",
color: "black",
haloColor: "white",
haloSize: "2px",
text: "\ue61d ${training_site}",
xoffset: 0,
yoffset: 0,
font: { // autocast as new Font()
size: 12,
family: "CalciteWebCoreIcons",
weight: "bolder"
}
};
this.motoLayer.renderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: symbol
};
this.map.add(this.motoLayer);
I tried putting a function in as well and that did not work.