Fullstack Portal Created by the HCMR for the Marine Strategy Framework Directive Program in order to cover demands and aspects considering extendability and maintainability
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
817 B

2 years ago
function createPie(data, year) {
var charts = L.featureGroup();
let features = data.features.filter(f => {
return f.properties.YR == year;
});
2 years ago
let newData = {};
features.forEach(f => {
let latlng = f.geometry.coordinates;
2 years ago
for (property in f.properties) {
const mapKey = fisheriesMap.get(property);
if (mapKey) {
newData[mapKey] = f.properties[property];
}
}
2 years ago
    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;
}