Hi,
I am creating graphics layer using esri.layers.GraphicsLayer. I need to display some key field value of that layer on graphics as label.Can i achieve using esri.symbol.TextSymbol?
My code is like this :
function ZoomshowResults(featureSet)
{
var zoomresultFeatures = featureSet.features;
var ZoomGraphicsLayer= new esri.layers.GraphicsLayer({id:"1"});
var il;
for (var i=0, il=zoomresultFeatures.length; i<il; i++) {
var zoomgraphic = zoomresultFeatures;
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([72,61,139,0.35]), 1),new dojo.Color([72,61,139,0.35]));
zoomgraphic.setSymbol(symbol);
ZoomGraphicsLayer.add(zoomgraphic);
}
map.addLayer(ZoomGraphicsLayer);
map.graphics.enableMouseEvents();
}
Thanks in advance..
Sowmya
Yes if you don't want to use InfoTemplate to display field value. However, you have to figure out a labeling point to display your text. There are a lot of ways to get the labeling point such as using geometry serivce's labelPoints method, using the centroid of the graphic's extend, or popluating x, y of the label point into your query layer and get them through graphic.attributes["X"]...
Hi,
Thanks for the response 🙂
I am getting set of polygon feature for querytask. One of the key field i need to display on polygon as label. I can create label for clicked point on map. How to label polygon?
Thanks,
Sowmya