Use group color for the marker-cluster

This commit is contained in:
Arik Fraimovich
2016-10-08 11:59:19 +03:00
parent 03217dd7ea
commit 7cbf350b73

View File

@@ -127,7 +127,32 @@
var markers;
if ($scope.visualization.options.clusterMarkers) {
markers = L.markerClusterGroup();
var color = $scope.visualization.options.groups[name].color;
var options = {};
if (classify) {
options.iconCreateFunction = function (cluster) {
var childCount = cluster.getChildCount();
var c = ' marker-cluster-';
if (childCount < 10) {
c += 'small';
} else if (childCount < 100) {
c += 'medium';
} else {
c += 'large';
}
c = '';
var style = 'color: white; background-color: '+color+';';
return L.divIcon({ html: '<div style="'+style+'"><span>' + childCount + '</span></div>', className: 'marker-cluster' + c, iconSize: new L.Point(40, 40) });
}
}
markers = L.markerClusterGroup(options);
} else {
markers = L.layerGroup();
}