jeudi 30 juillet 2020

Mapbox multiple If statement in a Var

I'm trying to change Mapbox marker colors according to a column tag. I have 3 separate columns Apple, Banana, and Orange I would like to associate that tag with a different marker color. This is my code so far. As of now, no markers show on the map.

var marker = new mapboxgl.Marker;({
          if (row["Apple"]) {
            color: 'blue';
          }
          else if (row["Banana"]) { 
            color: 'orange';
          }
          else (row["Orange"]) {
          color: 'yellow';
        }
        })

Aucun commentaire:

Enregistrer un commentaire