Closed chihuahua closed 8 years ago
Nvm, silly me. I could just bind the data directly to an SVG element via d3.
I'm running into this myself, could you please describe a bit more how you solved your problem? I'm having trouble with the D3-side of things in this library. This is my code currently:
.nodes.forEach((n) => {
this.graph.setNode(n.id.toString(), {
'data-id': n.id,
label: n.label,
class: this.companiesQuery.getActiveId() === n.id ? 'active' : '',
});
});
data.edges.forEach((l) => {
this.graph.setEdge(l.source.toString(), l.target.toString(), {
arrowhead: 'undirected',
});
});
The part of data-id
on setNode
of course doesn't work, how did you make that work?
Is it possible to add data- attributes to the SVG elements of nodes when calling setNode?