0
지구를 만들기 위해 d3을 사용하고 있습니다. 나는 "unrepresented"라는 배열에 있는지에 따라 국가의 채우기 색상을 변경하고 싶습니다. 하지만 채우기 색상을 변경할 수는 없습니다. 잘못된 구문을 사용합니까?d3에서 채우기 색상 재설정
d3.json("world-countries.json", function(collection) {
feature = svg.selectAll("path")
.data(collection.features)
.enter().append("svg:path")
.attr("d", clip)
.attr("id", function(d) { return d.id; })
.on("mouseover", pathOver)
.on("mouseout", pathOut)
.on("click", click);
feature.append("svg:title")
.text(function(d) { return d.properties.name; });
feature.each(function(){
thisOne = $(this).attr('id');
for (var i=0; i<unrepresented.length; i++){
if ($(this).attr('id') == unrepresented[i]) {
thisOne.style("fill", "#000000");;
}
}
});
});
하지만 지금은 오류가 발생합니다 : 다음 코드는 작동합니다 오류 : 문제 분석 D = ""관련이없는 오류입니다 – LauraNMS
을. 완벽한 예제를 게시 할 수 있습니까? –
아니요, 내 코드에 뭔가 다른 문제가 있습니다. 당신의 대답은 옳습니다. 고마워, 라스! – LauraNMS