Complete newbie with javascript here, so please be gentle...
I'm trying to define a different colour for a line depending on the current value of a variable "pressure".
I tried the code below but obviously this doesn't work. Can anyone help me in the right direction to do an IF statement, or if this is not the way, how do I do this?
var pivotLine = new google.maps.Polyline({
path: [gps, pivotcentre],
// strokeColor: "#fafd00",
if(pressure >= 1.35 and pressure <= 1.55){
strokeColor = "#00ff00";
};
if(pressure < 1.35){
strokeColor = "#996600";
};
if(pressure > 1.55){
strokeColor = "#ff33cc";
};
strokeOpacity: 1,
strokeWeight: 5
});
strokeOpacity: 1,
strokeWeight: 5
});
pivotLine.setMap(map);
Aucun commentaire:
Enregistrer un commentaire