Cartes avec cluster de points si > lignes #65

This commit is contained in:
Colin Maudry
2026-03-15 16:05:33 +01:00
parent 302d253e6e
commit adc8457abc
3 changed files with 55 additions and 24 deletions
+6 -2
View File
@@ -11,11 +11,15 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
}).bindTooltip(feature.properties.tooltip);
},
clusterToLayer: function (feature, latlng, index, context) {
console.log(feature);
console.log(index);
console.log(context);
const count = feature.properties.point_count;
const size = count < 100 ? 30 : count < 1000 ? 40 : 50;
const color = "#333"; // Default cluster color
const color = "#555"; // Default cluster color
const icon = L.divIcon({
html: `<div style="background-color: ${color}; width: ${size}px; height: ${size}px; border-radius: 50%; display: flex; align-items:center; justify-content:center; color: white; border: 2px solid white; font-weight: bold;">${count}</div>`,
html: `<div style="background-color: ${context.fillColor}; width: ${size}px; height: ${size}px; border-radius: 50%; display: flex; align-items:center; justify-content:center; color: white; border: 2px solid white; font-weight: bold;">${count}</div>`,
className: "marker-cluster",
iconSize: L.point(size, size),
});