Adding FontAwesome icons to a D3 graph

后端 未结 9 2249
既然无缘
既然无缘 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:44

    For those who banging their head hard. D3 - 6.2.0 and FontAwesome - 5.13.0 Below worked

    nodeEnter.append('text')
        .attr('width', "10px" ).attr('height', "10px" ) // this will set the height and width
        .attr("class","fas fa-adjust") // Font Awesome class, any
        .attr("x", 15) // for placement on x axis
        .attr("y",-5); // for placement on y axis
    

提交回复
热议问题