Select to view content in your preferred language

How to add text to the map as a graphic?

1067
3
Jump to solution
02-22-2013 02:04 AM
StephenLead
Honored Contributor
The draw toolbar allows the user to create points, lines and polygons, which can be added to the map as graphic objects.

Is there a similar mechanism to create free text? This would be similar to the Draw toolbar in ArcMap, which has an option to add labels.

Thanks,
Steve
0 Kudos
1 Solution

Accepted Solutions
RahulMetangale1
Frequent Contributor
Steve,

You can use TextSymbol for this purpose. Here is the API reference link:
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#textsymbol

-Rahul

View solution in original post

0 Kudos
3 Replies
RahulMetangale1
Frequent Contributor
Steve,

You can use TextSymbol for this purpose. Here is the API reference link:
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#textsymbol

-Rahul
0 Kudos
StephenLead
Honored Contributor
Hi Rahul,

So you could attach a listener to the draw toolbar, and pop up a text-input object to ask for the text input, then symbolise it with a textSymbol. Cool.

Thanks for the tip,
Steve
0 Kudos
RahulMetangale1
Frequent Contributor
Steve,

You can add a tool for text label in draw toolbar. Add the necessary graphic layer when it is clicked. Then start listening for map click event. On map click event you can show a info window where user can enter label information, set the font etc.

I hope this helps.

Rahul
0 Kudos