I have 3 places with marker, i need to give different colors for all 3 markers, can anyone help me.I had tried giving colors inside object as well but nothing worked.I need 3 random colors for all the 3 coordinate points given. I also want to loop the component in an array and should be called to html bu using *ngFor.
Component:
import mapboxgl from 'mapbox-gl';
mapboxgl.accessToken = 'pk.eyJ1IjoicmFrc2hpdGhhMTkiLCJhIjoiY2pjcHl1YW5wMjR5czJ6bzdqdjZrbDRzeSJ9.OOqu6zVyNsXavzCsYoBdPA';
var map = new mapboxgl.Map({
container: 'maps',
style: 'mapbox://styles/mapbox/streets-v9',
center: [12.568337,55.676098],
zoom: 9
});
map.on('load', function () {
map.addLayer({
"id": "points",
"type": "circle",
"paint":{
"circle-radius":10,
"circle-color":
'green'
},
"source": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
12.568337,55.676098
]
}
}
}
]
}
},
});
});
HTML:
<div id='maps' style='height: 440px;min-width:100%'></div>