I'm trying to select a node using a checkbox, and change their opacity but it have being impossible. I have try using a conditional. Does I need something else? Like:
if (typeFilterList.includes(id)) {
node.style("opacity", 0.2);
} else {
node.style("opacity", 2.0);
}
My code is the following:
function cambio(){
d3.selectAll(".filter-btn1").each(function(d){
cb = d3.select(this);
grp = cb.property("value")
if(cb.property("checked")){
if (grp === "Azuless") {
alert("Azuless")
node.style("opacity", 0.2);
}
}else{
alert("no chekeado");
node.style("opacity", 2.0);
}
})
}
d3.selectAll(".filter-btn1").on("change",cambio);
cambio();
Every time I check one of the checkbox the opacity of node change, but it doesn't change.
Aucun commentaire:
Enregistrer un commentaire