I have one function which creates poly line & adds that polyline to map
function makeRoute(e)
{
if(pointsSelection.length > 0)
{
pointsSelection.push(e.target.getLatLng());
var firstpolyline = new L.Polyline(pointsSelection, {
color: 'blue',
weight: 5,
smoothFactor: 1
});
firstpolyline.addTo(map);
pointsArrayCollection.push(pointsSelection);
polyArrayCollection.push(firstpolyline);
selection = [];
pointsSelection = [];
}
else
{
alert("Please select more than one point");
}
}
my problem is that It adds line with same color every time.
I want to add poly lines with different colors every time.
So how can I change color of polyline dynamically.
