Let's assume:
- your cluster image files are in place and have indexes of 1-green; 2-yellow; 3-red;
- references to your marker icons (string|Icon|Symbol) are made available as properties of the object,
markerIcons
var markerIcons = {
'green': '...',
'yellow': '...',
'red': '...'
};
Then, you can control which cluster icons are displayed with a calculator function as follows :
var myClusterer = new MarkerClusterer(map, {
...,//options
});
mc.setCalculator(function(markers, numStyles) {
var index = 1;//green
loop:
for(var i=0; i<markers.length; i++) {
switch(markers[i].getIcon()) {
case markerIcons.yellow:
index = 2;//yellow
break;
case markerIcons.red:
index = 3;//red
break loop;
break;
}
}
var index = Math.min(index, numStyles);
return {text:markers.length, index:index};
});