0

Is it possible in jsPlumb toolkit to dynamically position the content based on the number and type of objects to be drawn and connected. I mean currently the example they gave, uses css to position the each nodes which is not a good option when we are dynamically generating the visualization as we wont know how much number of objects(nodes) will be available in a network. Is it posible to make it dynamic?

NB: Totally newbie in jsplumb.

Prashanth Shyamprasad
  • 827
  • 2
  • 17
  • 39
  • Just position your elements dynamically using JS to set their top/left – Ruan Mendes Feb 10 '13 at 05:19
  • is there any such default option in jsPlumb? can you get me a sample code stuff that may help in developing mine. I'm trying to draw network topology of an institution. New nodes may come sometimes, may get removed too. nodes details are provided by snmp – Prashanth Shyamprasad Feb 10 '13 at 11:08

2 Answers2

3

No. It's up to you to position your elements. jsPlumb simply 'plumbs' them.

jungos
  • 476
  • 5
  • 21
1

yes, it is possible (well, four years after the accepted answer, but still). Consider how you want your nodes to be drawn first. If you would like to draw a tree or organizational chart, for example, you may want to use the hierarchical layout by setting the surface option layout type like so:

var toolkit = jsPlumbToolkit.newInstance();

//... load data...

var surface = toolkit.render({
    container:"someElement",
    layout:{
    type:"Hierarchical",
    parameters:{
      padding:[ 50, 50 ]
    }
  }
});

When using this layout type, jsplumb will dynamically position the nodes automatically.

Shahar
  • 2,269
  • 1
  • 27
  • 34