AnsweredAssumed Answered

Change png icon's background color dynamically for feature in feature layer

Question asked by soldous on Apr 25, 2017
Latest reply on Apr 28, 2017 by soldous

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:

var symb = new PictureMarkerSymbol("images/trafLight.png",12,25);
var colorHex = Color.fromHex('#'+ String(item.color));
symb.setColor(colorHex);
var geometry = new Point({"x":"-"+item.geometry.y,"y":"-"+item.geometry.x,"spatialReference":{"wkid":102067}});
var graphic = new Graphic(geometry);
graphic.setSymbol(symb);
features.push(graphic);

The color doesn't change and if so I think it would change color of the border lines not the background color. 

Outcomes