Hi!
How I can change each coordinate by color. For example [55.80, 37.50] is green, [55.70, 37.40] is yellow and etc.
ymaps.ready(init);
function StrokeColor(res) {
switch (res) {
case 1: return "#04630F";
case 2: return "#FFFF00";
case 3: return "#A91209";
}
}
function init() {
//Create variable for switch case
var res = 2;
// Creating the map.
var myMap = new ymaps.Map("map", {
center: [55.72, 37.44],
zoom: 10
}, {
searchControlProvider: 'yandex#search'
});
// Creating a polyline using the GeoObject class.
var myGeoObject = new ymaps.GeoObject({
// Describing the geometry of the geo object.
geometry: {
// The "Polyline" geometry type.
type: "LineString",
// Specifying the coordinates of the vertices of the polyline.
coordinates: [
[55.80, 37.50],
[55.70, 37.40],
[55.60, 37.30],
[55.50, 37.20]
]
},
// Defining properties of the geo object.
properties:{
// The contents of the hint.
hintContent: "I'm a geo object",
// The contents of the balloon.
balloonContent: "You can drag me"
}
}, {
/**
* Setting the geo object options.
* Enabling drag-n-drop for the polyline.
*/
draggable: true,
// The line color.
strokeColor: StrokeColor(res),
// Line width.
strokeWidth: 5
});
// Adding lines to the map.
myMap.geoObjects
.add(myGeoObject);
}