fkling / JSNetworkX

Build, process and analyze graphs in JavaScript (port of NetworkX)
https://felix-kling.de/jsnetworkx/
Other
757 stars 185 forks source link

Label for edges #87

Open rectangel-paul opened 4 years ago

rectangel-paul commented 4 years ago

I'm working on my visualization project using JSNetworkx but cannot find a way to add label on the edges. Please someone help me.

piglesias1 commented 4 years ago

Hi @rectangel-paul,

The issue is when updating the edge labels. During the creation process, it works fine. #70

A quick fix is to change the line 759 of the src/drawing/sgv.js with the following code:

  if (config.withEdgeLabels) {
    selection.selectAll('text')
      .attr(config.edgeLabelAttr)
      .style(config.edgeLabelStyle)
      .text(config.edgeLabels);
  }

If you want to get the already compiled (for browser) version with this fix, take it at: https://github.com/piglesias1/JSNetworkX/blob/master/jsnetworkx.js

Hope it helps!

Thanks, Pablo Iglesias