JSFiddle - React, Tailwind, and code Playground
by Gonzalo
JavaScript
setMarkerSuppliersCountry: function(){
var markers = [], _self= this;
Globals.markers.suppliersCountry = [];
$.each(Globals.data.suppliersCountry.countries, function(index, element){
element.properties = element.properties||{name:'', numOfSuppliers:0};
if(index!=''){
var country = {
properties: element.properties||{name:'', numOfSuppliers:0},
geometry: element.geometry,
markers:[]
};
var m = _self.getMarkerSize(parseFloat(element.properties.numOfSuppliers), 'suppliers');
if(element.suppliers){
$.each(element.suppliers, function(key, product){
$.each(product, function(i, j ){
country.markers.push({
lat: parseFloat(j.lat), lng: parseFloat(j.lng),
data: {countryName:element.properties.name, numOfSuppliers:element.properties.numOfSuppliers, supplierName:key, info: j},
options: {icon: new google.maps.MarkerImage('imgs/pin_70x70.png', null, null, null, new google.maps.Size(m, m))}
});
});
});
}
Globals.markers.suppliersCountry.push(country);
}
});
},