简体   繁体   中英

How to change edge thickness in D3.js?

代码示例https://jsfiddle.net/greggyNapalm/xtg7t5ch/我想通过weight attr控制边缘厚度。

尝试添加:

 .attr("style", function(d) { return ("stroke-width:" + d.weight + "px;");})

First remove this line from your path.link class from CSS file.

stroke-width: 2.0px;

Then, in your java-script file add following line in path variable.

.attr("stroke-width", function(d) { return (d.weight); })

Another method by which you can override the style property which @drone6502 suggested, is to add style attribute. Here, no need to remove stroke-width from CSS.

.attr("style", function(d) { return ("stroke-width:" + d.weight + "px;");})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM