function createPie(data, year) { var charts = L.featureGroup(); let features = data.features.filter(f => { return f.properties.YR == year; }); let newData = {}; features.forEach(f => { let latlng = f.geometry.coordinates; for (property in f.properties) { const mapKey = fisheriesMap.get(property); if (mapKey) { newData[mapKey] = f.properties[property]; } }     var pieData = {values: Object.values(newData), labels: Object.keys(newData)};     let chart = new PieChartMarker([latlng[1], latlng[0]], pieData, { icon: L.divIcon({className: 'leaflet-pie-chart-marker'}), width: 60, height: 60, colors: ['#ff0000', '#00ff00', '#0000ff', '#ff00ff'] }); charts.addLayer(chart); }); return charts; }