Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate custom count in custom cluster icon #875

Open
nsr092000 opened this issue May 15, 2024 · 2 comments
Open

Calculate custom count in custom cluster icon #875

nsr092000 opened this issue May 15, 2024 · 2 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@nsr092000
Copy link

In the previous library, @googlemaps/markerclustererplus , has a feature to calculate custom count on cluster

const calculator = (markers)=>{
// By default I got markers listing .....
}

FOR EXAMPLE:-
const options = {
calculator: calculator,
};
const mc = new MarkerClusterer(map, [], options);

but on this new library, there is a render method that helps to calculate the count on the cluster but I don't want to show a count of markers present on the cluster.

DOUBT:- I am showing the count on a marker by some calculation when it clusters, I want to show the sum of the calculation count, not the marker count ...

Please give me any solution or other way to solve this, that I am missing out on.

@nsr092000 nsr092000 added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 15, 2024
@wangela
Copy link
Member

wangela commented May 15, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@nsr092000 Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

@mark-emc
Copy link

mark-emc commented Jun 10, 2024

Please give me any solution or other way to solve this, that I am missing out on.

I just encountered this issue maintaining a legacy project. Here's a temporary workaround until we can access a cluster's marker array during render, or can use a custom calculation function for labeling.

google.maps.event.addListener(markerCluster, 'clusteringend', onClusteringEnd);

function onClusteringEnd(e)
{		
	for(var i=0; i<e.clusters.length; i++) {
		
		console.log(e.clusters[i].marker);
		
		for(var j=0; j<e.clusters[i].markers.length; j++) {	
		
			console.log(e.clusters[i].markers[j]);	
			
		}
		
		e.clusters[i].marker.title = 'new title ' + j;		
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants