Hello,
I have a point feature layer created from feature collection. As symbol for features in this FL is a png image with transaprent background. For every feature I have a html code of color readed from web service. Is it possible to change the background color for every feature using this hex code?
I tried a pictureMarkerSymbol:
<SPAN class="keyword token">var</SPAN> symb <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">PictureMarkerSymbol</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"images/trafLight.png"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">12</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">25</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> colorHex <SPAN class="operator token">=</SPAN> Color<SPAN class="punctuation token">.</SPAN><SPAN class="token function">fromHex</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'#'</SPAN><SPAN class="operator token">+</SPAN> <SPAN class="token function">String</SPAN><SPAN class="punctuation token">(</SPAN>item<SPAN class="punctuation token">.</SPAN>color<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
symb<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setColor</SPAN><SPAN class="punctuation token">(</SPAN>colorHex<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> geometry <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Point</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="string token">"x"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="string token">"-"</SPAN><SPAN class="operator token">+</SPAN>item<SPAN class="punctuation token">.</SPAN>geometry<SPAN class="punctuation token">.</SPAN>y<SPAN class="punctuation token">,</SPAN><SPAN class="string