Can you have multiple lines for a textSymbol?

3858
7
09-09-2015 02:02 PM
TracySchloss
Frequent Contributor

Is it possible to create a stacked textSymbol?  If so, what is the syntax for the linebreak?

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

in python it is "\n" in some environments it is "\r\n" might be worth a try since I found one example in this environment

https://community.esri.com/message/430718#430718

0 Kudos
TracySchloss
Frequent Contributor

I tried \n already, but that didn't work.  I also tried \r\n, but nothing.  It just prints them as characters. I also tried <br>. 

0 Kudos
SteveCole
Frequent Contributor

How about trying the ASCII character code for line break, carriage return, etc?

var text = 'This is line one' + String.fromCharCode(10) + 'This is line two';

0 Kudos
TracySchloss
Frequent Contributor

That didn't work, but this looks like a possibility.  I haven't tried it yet.  suytt/esri.symbol.MultiLineTextSymbol · GitHub

0 Kudos
TracySchloss
Frequent Contributor

Update:  I couldn't get this to work for me either.  Maybe it's too out of date, although it did say it was 2014, which isn't that old.

0 Kudos
weeyeo
by
New Contributor II

Tracy, I able to get this to work.  You can save the js file - esri.symbol.MultiLineTextSymbol.js and then just add this:

<script type="text/javascript" src="js/esri.symbol.MultiLineTextSymbol.js"></script>

Hope this help.

Thanks.

0 Kudos
JoshHevenor
Occasional Contributor II

I usually just add two symbols and adjust the yoffset value. I'm guessing the same approach was wrapped up nicely in the referenced github lib.

0 Kudos