Вот мой код:
Код: Выделить всё
//"Tenant" checkboxes
top:13px">Regus
Spaces
//"Broker" checkboxes
CBRE
Colliers
//Filter by "Tenant"
d3.selectAll("#RegusCheckbox").on("change", function() {
var type = "Regus"
display = this.checked ? "inline" : "none";
d3.selectAll(".features")
.filter(function(d) { return d.properties.Tenant === type; })
.attr("display", display);
});
d3.selectAll("#SpacesCheckbox").on("change", function() {
var type = "Spaces"
display = this.checked ? "inline" : "none";
d3.selectAll(".features")
.filter(function(d) { return d.properties.Tenant === type; })
.attr("display", display);
});
//And, filter by "Broker"
d3.selectAll("#CBRECheckbox").on("change", function() {
var type = "CBRE"
display = this.checked ? "inline" : "none";
d3.selectAll(".features")
.filter(function(d) { return d.properties.Agency_Bro === type; })
.attr("display", display);
});
d3.selectAll("#ColliersCheckbox").on("change", function() {
var type = "Colliers International"
display = this.checked ? "inline" : "none";
d3.selectAll(".features")
.filter(function(d) { return d.properties.Agency_Bro === type; })
.attr("display", display);
});
Подробнее здесь: https://stackoverflow.com/questions/539 ... ries-in-d3
Мобильная версия