D3.js tree with odd number of vertices, edges not shown

烈酒焚心 提交于 2019-11-29 17:14:44

You are missing the style for the node links. Something variation of this:

<style>
.link {
    fill: none;
    stroke: #ccc;
    stroke-width: 4.5px;
}
</style>

Or, set it on the link itself:

.attr("d", diagonal).attr({ 'fill': 'none', 'stroke': 'grey', 'stroke-width': 4 });

It depends on odd vs. even number because by default a path gets no stroke and a fill color of black. So a straight line doesn't show up but the curved ones get filled.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!