react-jvectormap icon indicating copy to clipboard operation
react-jvectormap copied to clipboard

Set Different Color for a set of markers

Open rananaresh86 opened this issue 4 years ago • 1 comments

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

rananaresh86 avatar Dec 28 '20 03:12 rananaresh86

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??

UditDubey210 avatar Jun 09 '21 13:06 UditDubey210