Stack
- FontAwesome v5
- D3js v4
- Angular 4
Scenario
I have a hierarchy tree with nodes that have option bubbles appended to it (think of it as Mickey Mouse balloon where the face is the node and the appended nodes are the ears). I would like those options to show an icon like FontAwesome's i for more information or x to delete.
mickey.append('text')
.attr('x', 15)
.attr('y', -17)
.attr('fill', 'black')
.attr('font-family', 'FontAwesome')
.attr('font-size', function (d) { return '20px' })
.text(function (d) { return '\uf2b9' });
I also imported the FontAwesome 5 javascript CDN in index.html
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
Above is what we currently have. The left ear has .text('i')
and the right is the FontAwesome icon I am trying to render.
Additonally, We are already using FontAwesome throughout the app using
<i>
's, but I'm not sure how to use it as a font-family to be able to implement it with D3 in the SVG.
Possible Solution
I found this solution in another post which is almost exactly what I need but wasn't sure how to bring everything together.
Request
Can someone provide some sample code that shows how to import and use FontAwesome v5 in a D3.js V4 created text
svg in Angular 4?
Thanks!