我是一个新的 javascript 程序员。我正在尝试制作一个基于类别绘制圆圈的可视化(“基本上每个圆圈上都有一个类别”)。我的问题是我的代码只打印一个圆圈,所有类别都在彼此之上。
<script>
var width = 600;
var height = 600;
var data = d3.json("/data", function(error, data){
console.log(data)
// Make SVG container
var svgContainer = d3.select("body")
.append("svg")
.attr("width", width)
.attr("height", height);
var elem = svgContainer.selectAll("div")
.data(data);
var elemEnter = elem.enter()
.append("g")
var circles = elemEnter.append("circle")
.attr("cx", 100)
.attr("cy", 100)
.attr("r",80)
.style("fill", "blue")
elemEnter.append("text")
.attr("dy", function(d){
return d.SkillProficiencyId +80;
}).attr("dx",function(d){ return d.SkillProficiencyId-1;})
.text(function(d){return d.CategoryName});
});
</script>

互换的青春
蛊毒传说
随时随地看视频慕课网APP
相关分类