最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - D3 treecluster diagram - changing node text color - Stack Overflow

programmeradmin5浏览0评论

I would like to have diagram similar to this one: (the most important part is that I would like to have node text displayed in several colors; it doesn't matter whether the diagram is tree or cluster)

This is a test example:

jsfiddle

I tried changing text color via CSS, and within JavaScript code, bit it always remains black. Why?

I would like to have diagram similar to this one: (the most important part is that I would like to have node text displayed in several colors; it doesn't matter whether the diagram is tree or cluster)

This is a test example:

jsfiddle

I tried changing text color via CSS, and within JavaScript code, bit it always remains black. Why?

Share Improve this question asked Mar 19, 2016 at 16:05 VividDVividD 10.5k8 gold badges66 silver badges112 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

I found the answer:

    fill: #5555ff;    

in CSS for node/text solves the problem.

SVG text element does not care about color attribute, like other HTML elements. Setting fill is the right way.

发布评论

评论列表(0)

  1. 暂无评论