Skip to content

Commit

Permalink
Data category option within clustering script
Browse files Browse the repository at this point in the history
Add option defining extra class name to cluster creation, for connecting
each category's markers to CSS colors
  • Loading branch information
akhtars committed Sep 21, 2014
1 parent 38b00a5 commit b929d6a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions assets/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
chunkInterval: 200,
chunkDelay: 50,
chunkProgress: null,
polygonOptions: {}
polygonOptions: {},
clusterClass: "" // New option for selecting categorical color coding
},
initialize: function(e) {
L.Util.setOptions(this, e);
Expand Down Expand Up @@ -438,9 +439,14 @@
} else {
n += "large"
}
if (this.clusterClass.toString() != "") {
var x = " marker-cluster-" + this.clusterClass.toString()
} else {
var x = ""
}
return new L.DivIcon({
html: "<div><span>" + t + "</span></div>",
className: "marker-cluster" + n,
className: "marker-cluster" + n + x,
iconSize: new L.Point(40, 40)
})
},
Expand Down

0 comments on commit b929d6a

Please sign in to comment.