Hello everyone,
I want to add the label for the graphic layer.I have a graphic layer contain graphic,symbol and attributes. Now, I want to add a label from that graphic layer. Is it possible, if yes can anyone share the code because i see the sample of the 'esri/layers/LabelLayer' all are coming from the feature layer.
Thanks for the help.
Solved! Go to Solution.
Then you get the polygons extent using
var pnt = geometry.getExtent().getCenter();
var txtSym = new TextSymbol("Hello World");
var lblGra = new Graphic(pnt, txtSym);
bufferGL.add(lblGra);
Sai,
Probably the easiest way to do this is to add another graphic (the center of the extent for polygons or polylines) using a TextSymbol as the graphics symbol.
Thanks Robert.
Can you share the javascript code for above logic. I am not understand how we can set center of the graphics into the center of the graphics symbol.
Sai,
What is the geometry type that you are trying to label?
Thank Robert.
Polygon type. Need to work on this code Draw polygon feature when ever use click on the map
Then you get the polygons extent using
var pnt = geometry.getExtent().getCenter();
var txtSym = new TextSymbol("Hello World");
var lblGra = new Graphic(pnt, txtSym);
bufferGL.add(lblGra);