We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Being able to change the style of marker clusterer
Being able to change the render class while enabling the clustering.
render
googleMap.enableClustering(5, customRenderer)
Then anyone could fiddle with it by passing a custom renderer
// Example import { Cluster, ClusterStats, DefaultRenderer, Marker } from '@googlemaps/markerclusterer'; export class CustomRenderer extends DefaultRenderer { constructor() { super() } render({ count, position }: Cluster, stats: ClusterStats, map: google.maps.Map): Marker { const color = count > Math.max(10, stats.clusters.markers.mean) ? "#ff0000" // <-- Change the color here : "#0000ff"; // create svg url with fill color const svg = window.btoa(` <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240"> <circle cx="120" cy="120" opacity=".6" r="70" /> <circle cx="120" cy="120" opacity=".3" r="90" /> <circle cx="120" cy="120" opacity=".2" r="110" /> <circle cx="120" cy="120" opacity=".1" r="130" /> </svg>`); // create marker using svg icon return new google.maps.Marker({ position, icon: { url: `data:image/svg+xml;base64,${svg}`, scaledSize: new google.maps.Size(45, 45), }, label: { text: String(count), color: "rgba(255,255,255,0.9)", fontSize: "12px", }, // adjust zIndex to be above other markers zIndex: 1000 + count, }); } }
We could instantiate a CustomRenderer object and be able to change the style & logic of it from other methods.
CustomRenderer
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Feature Request
Plugin
Description
Being able to change the style of marker clusterer
Preferred Solution
Being able to change the
render
class while enabling the clustering.googleMap.enableClustering(5, customRenderer)
Then anyone could fiddle with it by passing a custom renderer
Alternatives
We could instantiate a
CustomRenderer
object and be able to change the style & logic of it from other methods.Additional Context
The text was updated successfully, but these errors were encountered: