Adding FontAwesome icons to a D3 graph

后端 未结 9 2251
既然无缘
既然无缘 2020-11-27 12:07

I am trying to set an icon with FontAwesome instead of text in my D3 nodes. This is the original implmentation, with text:

g.append(\'svg:text\')
    .attr(\         


        
9条回答
  •  时光说笑
    2020-11-27 12:39

    Just to put in code here what worked for me based on CarlesAndres's answer and mhd's comment:

    node.append("text")
        .attr("style","font-family:FontAwesome;")
        .attr('font-size', "50px" )
        .attr("x", 440)
        .attr("y", 440)
        .text(function(d) { return '\uf118' });
    

提交回复
热议问题