Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge labels are missing #70

Open
GhfDllT opened this issue Oct 27, 2017 · 0 comments
Open

Edge labels are missing #70

GhfDllT opened this issue Oct 27, 2017 · 0 comments

Comments

@GhfDllT
Copy link

GhfDllT commented Oct 27, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant