visjs - Fonts in custom SVG node Image with vis.js network -
i'm looking nodes circles font-icon in middle , stock label below. (http://jsbin.com/hiqega/3/edit?js,output) close i'm looking except need pass font name , icon code use.
function nodeimage(color, icon, font) { var svg = '<svg xmlns="http://www.w3.org/2000/svg" ' + 'width="120" height="120" viewport="0 0 120 120">' + '<ellipse ry="55" rx="55" cy="60" cx="60" ' + 'style="fill:' + color + ';stroke:black;stroke-opacity:.5;stroke-width:4;" />' + '<text x="61" y="63" text-anchor="middle" dominant-baseline="middle" ' + 'style="font-family:' + font + ';font-size:100px;fill:black;fill-opacity:.5;">' + icon + '</text>' + '</svg>'; return 'data:image/svg+xml;charset=utf-8,' + encodeuricomponent(svg); }
i'm calling nodeimage('red', '', 'fontawesome')
in page using font elsewhere don't think issue it's not loaded.
any suggestions on i'm going wrong?
i think need write nodeimage('red', '\uf03d', 'fontawesome'). http://visjs.org/examples/network/nodestyles/icons.html
"remember! unicode in javascript done this: \uf274 unicode f274. if node shown rectangle, means css not loaded (or not yet loaded). redraw fix that."
Comments
Post a Comment