hello

could you please show me how can i create an edge with multiple labels as it is done on the picture which i found here : http://forum.jgraph.com/questions/376/orthogonal-edge-style-feature-requests

best regards

asked 10 Jul '12, 15:41

anas's gravatar image

anas
34
accept rate: 0%


Add relative child cells to the edge. Here is an example:

var parent = graph.getDefaultParent();

// Adds cells to the model in a single step
graph.getModel().beginUpdate();
try
{
  var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30);
  var v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30);

  var edge = new mxCell('', new mxGeometry());
  edge.edge = true;

  var sourceLabel = new mxCell('parent', new mxGeometry(-1, 0, 0, 0),
    'resizable=0;align=left;verticalAlign=top;');
  sourceLabel.geometry.relative = true;
  sourceLabel.setConnectable(false);
  sourceLabel.vertex = true;
  edge.insert(sourceLabel);

  var targetLabel = new mxCell('child', new mxGeometry(1, 0, 0, 0),
    'resizable=0;align=right;verticalAlign=bottom;');
  targetLabel.geometry.relative = true;
  targetLabel.setConnectable(false);
  targetLabel.vertex = true;
  edge.insert(targetLabel);

  var e1 = graph.addEdge(edge, parent, v1, v2);
}
finally
{
  // Updates the display
  graph.getModel().endUpdate();
}
link

answered 11 Jul '12, 00:19

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

Hello Gaudenz,

Thank you for your answer,

i have another question. how can i write the edge label for example at the start (end) of the edge ? because i intent to use edges to link two equipments in a network topology, and i need to display ip addresses on both sides of the link. Simply, i will create two edges and on the first, i'm going to write the IP on its top, and on the second, it's going to be written on its bottom.

Thank you very much

(11 Jul '12, 04:38) anas

Try the example above as this is what it demonstrates.

(11 Jul '12, 04:38) Gaudenz
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×29

Asked: 10 Jul '12, 15:41

Seen: 1,761 times

Last updated: 11 Jul '12, 04:38