Wiki source code of HTTP-based Service
Version 3.1 by uru on 2013/11/27 02:34
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | == Language Bindings == | ||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | == Examples == | ||
| 10 | |||
| 11 | The graph is passed in serialized form of either graph format. In this example we use the JSON format (for JavaScript also native JSON can be passed). | ||
| 12 | |||
| 13 | {{code title="graph"}} | ||
| 14 | "{id:\"root\",children:[{id:\"n1\",labels:[{text:\"n1\"}],width:100,height:100}," | ||
| 15 | + "{id:\"n2\",labels:[{text:\"n2\"}],width:100,height:50,children:[{id:\"n3\"," | ||
| 16 | + "labels:[{text:\"n3\"}],width:20,height:20},{id:\"n4\",labels:[{text:\"n4\"}],width:20," | ||
| 17 | + "height:20}],edges:[{id:\"e4\",source:\"n3\",target:\"n4\"}]}]," | ||
| 18 | + "edges:[{id:\"e1\",source:\"n1\",target:\"n2\"}]}"; | ||
| 19 | {{/code}} | ||
| 20 | |||
| 21 | {{code title="options"}} | ||
| 22 | spacing: 100 | ||
| 23 | algorithm: "de.cau.cs.kieler.klay.layered" | ||
| 24 | edgeRouting: ORTHOGONAL | ||
| 25 | {{/code}} | ||
| 26 | |||
| 27 | === JavaScript === | ||
| 28 | |||
| 29 | {{code language="js"}} | ||
| 30 | var graph = "[graph]"; | ||
| 31 | var options = { opt1: val1 }; | ||
| 32 | $.kielerLayout({graph: graph, options: options, | ||
| 33 | iFormat: 'org.json', oFormat: 'org.json', | ||
| 34 | success : function (data) { | ||
| 35 | console.log(data); | ||
| 36 | } | ||
| 37 | }); | ||
| 38 | {{/code}} | ||
| 39 | |||
| 40 | === Java === | ||
| 41 | |||
| 42 | {{code language="java"}} | ||
| 43 | String graph = "[graph]"; | ||
| 44 | Map<String, Object> opts = new HashMap<String, Object>(); | ||
| 45 | String layouted = KIELERLayout.layout(server, "org.json", "org.json", options, graph); | ||
| 46 | {{/code}} | ||
| 47 | |||
| 48 | === C# === | ||
| 49 | |||
| 50 | {{code language="c#"}} | ||
| 51 | String graph = "[graph]"; | ||
| 52 | Dictionary<String, Object> options = new Dictionary<String, Object>(); | ||
| 53 | String layouted = KIELER.KIELERLayout.layout(server, "org.json", "org.json", options, graph); | ||
| 54 | {{/code}} | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 |