0

I use this example of mxGraph Editor

I'm trying to use the library to make ladder diagramming editor, so I want to draw start and end lines, but I need them all as a boundary for the diagramming area from left and right all time ( start with the editor every time ), how can I do that and how can I make them connectable to the elements?

can anyone help, please?

explaining image : what I want to do in a pic

Edit:

this code draws a line, then I positioned it with geometry property.

var xml = "<root>"+
                "<MyObject id=\"2\">"+
                "<mxCell style=\"strokeColor=black;fillColor=black\" parent=\"1\" vertex=\"1\" type = 'startLine'>"+
                "<mxGeometry x=\"0\" y=\"0\" width=\"2\" height=\"119\" as=\"geometry\"/>"+
                "</mxCell></MyObject></root>";
        doc = mxUtils.parseXml(xml),
        codec = new mxCodec(doc),
        elt = doc.documentElement.firstChild,
        cells = [];

        while (elt != null){                
            cells.push(codec.decodeCell(elt));
            elt.setAttribute('attribute1', 'value1');
            $this.editor.graph.refresh();
            elt = elt.nextSibling;
        }
        $this.editor.graph.addCells(cells);
Ahmed El Damasy
  • 671
  • 6
  • 13

1 Answers1

1

for the sake of the question being marked as "answered" and so that others can see it :

do this :

var xml = "<root>"+
                "<MyObject id=\"2\">"+
                "<mxCell style=\"strokeColor=black;fillColor=black\" parent=\"1\" vertex=\"1\" type = 'startLine'>"+
                "<mxGeometry x=\"0\" y=\"0\" width=\"2\" height=\"119\" as=\"geometry\"/>"+
                "</mxCell></MyObject></root>";
        doc = mxUtils.parseXml(xml),
        codec = new mxCodec(doc),
        elt = doc.documentElement.firstChild,
        cells = [];

        while (elt != null){                
            cells.push(codec.decodeCell(elt));
            elt.setAttribute('attribute1', 'value1');
            $this.editor.graph.refresh();
            elt = elt.nextSibling;
        }
        $this.editor.graph.addCells(cells);
tatsu
  • 2,316
  • 7
  • 43
  • 87
  • hey thanks but you need to mark this or someone else's answer as the solution otherwise everyone thinks the problem isn't solved including stackoverflow's and google's indexing algorithms. upvotes help too. – tatsu Sep 13 '18 at 13:51