I am working on Google Maps. I need to draw poly-lines with different color.
Here is my code.
var response = {
"points": [
[17.36603966, 78.45885158, 17.36608062, 78.46013904],
[17.36608062, 78.46013904, 17.36644926, 78.46131921],
]
};
for (var i = 0; i < response.points.length; i++) {
directionsService.route({
'origin': response.points[i][0] + ',' + response.points[i][1],
'destination': response.points[i][2] + ',' + response.points[i][3],
'travelMode': 'DRIVING'
}, function (directions, status) {
directionsDisplay = new google.maps.DirectionsRenderer({
suppressInfoWindows: true,
suppressMarkers: true,
polylineOptions: {
strokeColor:'red'
},
map: mymapid
});
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(directions);
}
});
};
How can I add dynamic color for my Points?