Using Google Maps V3 with MarkerCluster, you can see three different types of colors when clusertering, based on how many is clustered toghter.
Problem: I want to change the rule from based on how many, to how serious the case is on that area, its also represented in the custom icons I use. The types im working with is green for a good running product, yellow for a warning and red for a bad product.
I want to be able to see the red color on the cluster icon if there is a bad product in there somewhere, and not at all based on the number..
Im using ASP.NET MVC3 with razor - that maybe could help.
Can this be done guys?
Let's assume:
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};
});