Sigma JS - Display Shortcuts

How can we show border labels on Sigma.js? I know the show edge shortcut in sigma.js . But the code is not yet integrated with the trunk version.

+5
source share
1 answer

Now you can do this with the new plugin in the sigma repository: https://github.com/jacomyal/sigma.js/tree/master/plugins/sigma.renderers.edgeLabels

Just follow the instructions to create a Sigma project and you will find this file in the / build / plugins folder: sigma.renderers.edgeLabels.min.js

Include this in your html file:

<script src="sigma.min.js"></script> <script src="sigma.renderers.edgeLabels.min.js"></script> 

Make sure the key labeled

 var data = { // specify 'nodes' as well edges: [ { id: "e1", source: "user", target: "b1", label: "This is the label", // <----- define 'label' key for your edges }, ] } 

And then specify your renderer in Sigma initialization.

 var s = new sigma({ graph: data, renderer: { container: "container", type: "canvas" }, settings: { } }); 
+6
source

Source: https://habr.com/ru/post/1203222/


All Articles