Quantcast

Customize number ranges for cluster icons?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Customize number ranges for cluster icons?

Jordan Anderson
Hey all,

I've successfully set up marker clustering using custom cluster icons
by overriding CM.MarkerClusterer.ICONS[]. It seems that the ICONS
array is used to differentiate between number ranges e.g. ICONS[0] is
used for 1-9 markers, ICONS[1] is used for 10-99, ICONS[2] is used for
100-? or something like that.

Because our cluster ranges tend to be rather low, I'd like to use a
range with a lower distribution -- the maximum might be a cluster of
20 markers. Is there some way to specify this by overriding a property
of CM.MarkerClusterer, etc.?

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Customize number ranges for cluster icons?

Vladimir Agafonkin
Hi Jordan,

There's no such possibility yet, the cluster gets the power of 10 to reach the number of markers in a cluster as the index for ICONS. The only hack I could think of at the moment to change the distribution is something like this:

(function() {
    var originalCreate = CM.MarkerClusterer.Cluster.prototype._createClusterMarker;
    CM.MarkerClusterer.Cluster.prototype._createClusterMarker = function(len) {
        originalCreate.call(this, len * 5);
    }
})();

(this way the cluster will think it has 100 markers when it has 20, etc.)

On Tue, Jul 6, 2010 at 3:12 AM, Jordan Anderson <[hidden email]> wrote:
Hey all,

I've successfully set up marker clustering using custom cluster icons
by overriding CM.MarkerClusterer.ICONS[]. It seems that the ICONS
array is used to differentiate between number ranges e.g. ICONS[0] is
used for 1-9 markers, ICONS[1] is used for 10-99, ICONS[2] is used for
100-? or something like that.

Because our cluster ranges tend to be rather low, I'd like to use a
range with a lower distribution -- the maximum might be a cluster of
20 markers. Is there some way to specify this by overriding a property
of CM.MarkerClusterer, etc.?

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev



--
Vladimir Agafonkin
Front-End Architect, CloudMade
+380 93 745 44 61

_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Loading...