kadoshms / react-jvectormap

A react wrapper for jvectormap maps
MIT License
98 stars 70 forks source link

Set Different Color for a set of markers #83

Open rananaresh86 opened 3 years ago

rananaresh86 commented 3 years ago

Hi There,

Is there any we can set different colors for different markers on the map? I am using this way:

let markers = []; mapData.data.map((dObj, di) => { // console.log(dObj.name); const dcMarkers = {}; const latVal = dObj.lat.toFixed(2); const lngVal = dObj.long.toFixed(2); const latLong = [latVal, lngVal]; dcMarkers['latLng'] = latLong; dcMarkers['name'] = dObj.name; dcMarkers['style'] = { r: 5, fill: 'grey', stroke: '#505050', "fill-opacity": 1, "stroke-width": 1, "stroke-opacity": 1, }; // dcMarkers['markerStyle'] = {fill: 'red'}; // dcMarkers['selected'] = {fill: 'red'}; markers[di] = dcMarkers; });

On the style object, the radius is working but the fill is not working. Please help.

Thanks

UditDubey210 commented 3 years ago

Hi @rananaresh86 , i want to set markers for all countries in my app, so can you share how to set it ?? Is it compulsory to give lat and lng, if yes then from where we will get the exact value?? Can't library have itself??