How to show icon with label in a node vis-network graph

16 Views Asked by At

I am using vis-network to show network graph. I trying to show a icon font awesome icon in node. In current graph I am showing label in the node. Now, I want to show a icon as well with the label in node. Following is the icon that I want to show https://fontawesome.com/icons/java?f=brands&s=solid

Here is my code:

let nodes = [];
let links = [];
filteredData.forEach((e) => {
  let nodeObj = {};
  nodeObj['id'] = e.Id.name + '|' + empName;
  nodeObj['status'] = e.Status;
  nodeObj['label'] = `${e.Id.name}\nns: ${empName}`;
  nodeObj['ns'] = empName;
  nodeObj['level'] = 1;
  nodeObj['icon'] = {
    face: 'Font Awesome 5 Free',
    code: '\uf15b',
    size: 30,
  },
});
// calculation to create links array
return {
  nodes: nodes,
  links: links,
};

I tried to run this sample code but this is also not working. The label is not showing the icon. It is showing just the label. Currently the node look like this

How to show the icon with the node label?

0

There are 0 best solutions below