fkling/JSNetworkX

Edge labels are missing

Opened this issue · 0 comments

I'm trying to display label for edges.
As I know from https://github.com/fkling/JSNetworkX/wiki/Drawing-graphs it is connected with with_edge_labels and edge_labels, but I cannot get it working - edge_labels function is not called, edge_labels: "label" does not work too.

`var G = new jsnx.Graph();
G.addEdge(1,3, {label : "gg"});
G.addEdge(3,1, {label : "gg"});
G.addEdge(1,5, {label : "gg"});
G.addEdge(1,7, {label : "gg"});
G.addEdge(7,3, {label : "gg"});
G.addEdge(7,9, {label : "gg"});

jsnx.draw(G, {
    element: '#graph-viewport',
    withLabels: true,
    labels : function(d) { console.info(d); return d.label},
    with_edge_labels: true,
    edge_labels: function(d) { console.info(d); return d['label']},
    
    layoutAttr: {
      
    },
    nodeAttr: {
        r: 12,
        title: function(d) { return d.label;}
    },
    nodeStyle: {
        
    },
    edgeStyle: {
      'stroke-width': 5,
  }
});
d3.selectAll('.node').on('click', function(d) {
    console.info(d);
});
d3.selectAll('.edge').on('click', function(e) {
  console.info(e);

});`

Could you explain where I am wrong?