我正在尝试将图表中某些节点的形状更改为矩形而不是圆形。我一直在使用 d3,但使用 d3plus 库我似乎在附加元素/样式元素方面没有相同的控制?很可能我误会了什么!
在此先感谢您的帮助!
CodePen 链接:rough example
var nodes = [
{ id: "Practice 1", x: 1, y: 1 },
{ id: "Practice 2", x: 1, y: 2 },
{ id: "Practice 3", x: 1, y: 3 },
{ id: "Text A", x: 2, y: 1 },
{ id: "Text B", x: 2, y: 1.75 },
{ id: "Text C", x: 3, y: 1.5 },
{ id: "Text D", x: 3, y: 2.2 },
];
var links = [
{ source: "Practice 1", target: "Text A" },
{ source: "Practice 1", target: "Text B" },
{ source: "Text B", target: "Text C" },
{ source: "Text B", target: "Text D" },
];
new d3plus.Network()
.links(links)
.nodes(nodes)
.render();
body{
background-color: rgb(228, 224, 218);
}
circle{
fill: rgb(204, 192, 177)!important;
stroke: rgb(172, 122, 31);
stroke-width: 0;
width: 500px;
}