JeanAlesi
JeanAlesi

Reputation: 598

How can I change the color of a polyline in here.com javascript-api?

I have multiple polylines drawn in a map, I would like them to change their color of depending on some event... Is there a function to change the strokecolor property once the polyline object has been added to the map?

Upvotes: 2

Views: 1053

Answers (1)

Dr.Molle
Dr.Molle

Reputation: 117314

Use the setStyle-method:

polyline.setStyle( polyline.getStyle().getCopy({strokeColor:'Red'}));

The getCopy-method returns a copy of the given SpatialStyle where the properties of the argument({strokeColor:'Red'}) replace the properties of the given SpatialStyle

Upvotes: 5

Related Questions