markerclustererplus icon indicating copy to clipboard operation
markerclustererplus copied to clipboard

Enhancement for MarkerWithLabel

Open dinkom opened this issue 11 years ago • 1 comments

Hi guys,

I would like to extend MarkerClustererPlus to automatically aggregate values in labels (if the user chooses so and the label content is a number), instead of aggregating just the markers themselves. This functionality would extend the user's possibilities when working with MarkerWithLabel, but the normal Marker objects would not be affected.

Use case: I use one MarkerWithLabel to display the number of, for instance, visitors in one place. I don't want to use a 100 markers for one place, one is enough with a proper label. Now imagine I have N of these and they start to cluster. The cluster's default behaviour would be to show the number N, but now it could show the total number of viewers instead. Default behaviour would remain default and for the user to start using this functionality, one more property would have to be set on the MarkerClustererPlus (for instance "aggregateLabelValues = true").

I have already done most of it locally (I just need to add the extra property to decide when the functionality kicks in) and I use it in production, it works good. If you are interested, I can make a pull request during the weekend, when I finish it.

What do you think? @iloveitaly @mahnunchik

dinkom avatar Mar 13 '15 16:03 dinkom

@dinkom @iloveitaly I think that this functionality can be included in the library.

mahnunchik avatar Mar 17 '15 16:03 mahnunchik