change color of features in stream layer service

215
2
03-26-2019 12:29 PM
MRReddy
Occasional Contributor

hi

In stream layer service, I have a "type" field

I was trying to make if type is "a" then color blue

else if "b" then red

else green..........

streamLayer = new StreamLayer(url, {

purgeOptions: {

displayCount: 5000,

age: 2.5

}

});

map.addLayer(streamLayer);

how to assign color for streamLayer?

Thanks

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

You assign it a UniqueValue Renderer just like any other layer type:

https://developers.arcgis.com/javascript/3/jsapi/streamlayer-amd.html#renderer

MRReddy
Occasional Contributor

I tried with below code but it didn't worked

var uvr2 = {

type: "colorInfo",

field: "event_type",

uniqueValueInfos: [{

value: "available",

symbol: LiSymbol

}, {

value: "reserved",

symbol: BoSymbol}

, {

value: "unavailable",

symbol: ltSymbol}, {

value: "removed",

symbol: ltSymbol}]

};

streamLayer = new StreamLayer(url, {

renderer: uvr2,

purgeOptions: {

displayCount: 5000,

age: 2.5

}

});

map.addLayer(streamLayer);

 

0 Kudos