|
11 | 11 | <script type="text/javascript" src="layouts/force-directed-layout.js"></script>
|
12 | 12 | <script type="text/javascript" src="drawings/simple_graph.js"></script>
|
13 | 13 | <script type="text/javascript" src="drawings/sphere_graph.js"></script>
|
14 |
| - |
| 14 | + |
| 15 | + <script type="text/javascript"> |
| 16 | + var drawing; |
| 17 | + function createDrawing() { |
| 18 | + var index = parseInt(location.search.split("?")[1]); |
| 19 | + if(isNaN(index)) { |
| 20 | + index = 1; |
| 21 | + } |
| 22 | + switch(index) { |
| 23 | + case 0: |
| 24 | + drawing = new Drawing.SimpleGraph({layout: '2d', selection: true, numNodes: 50, showStats: true, showInfo: true}); |
| 25 | + break; |
| 26 | + case 1: |
| 27 | + drawing = new Drawing.SimpleGraph({layout: '3d', selection: true, numNodes: 50, showStats: true, showInfo: true}); |
| 28 | + break; |
| 29 | + case 2: |
| 30 | + drawing = new Drawing.SphereGraph({numNodes: 50, showStats: true, showInfo: true}); |
| 31 | + break; |
| 32 | + default: |
| 33 | + drawing = new Drawing.SimpleGraph({layout: '3d', selection: true, numNodes: 50, showStats: true, showInfo: true}); |
| 34 | + } |
| 35 | + document.getElementById("drawing_select").selectedIndex = index; |
| 36 | + } |
| 37 | + </script> |
| 38 | + |
15 | 39 | <style type="text/css">
|
16 | 40 | body {
|
17 | 41 | margin: 0;
|
|
29 | 53 | color: #333;
|
30 | 54 | padding: 5px 10px;
|
31 | 55 | }
|
| 56 | + #options { |
| 57 | + position: absolute; |
| 58 | + top: 0; |
| 59 | + right: 0; |
| 60 | + z-index: 10; |
| 61 | + } |
32 | 62 | </style>
|
33 | 63 | </head>
|
34 |
| - <body onload="new Drawing.SimpleGraph({layout: '3d', selection: true, numNodes: 50, showStats: true, showInfo: true})"> |
| 64 | + <body onload="createDrawing()"> |
| 65 | + <div id="options"> |
| 66 | + <form> |
| 67 | + <p> |
| 68 | + <label>Drawing</label><br> |
| 69 | + <select id="drawing_select" onchange="window.location.href = 'http://localhost/master/graph-visualization/index_example.html?' + this.selectedIndex;"> |
| 70 | + <option>2D-Force-Directed</option> |
| 71 | + <option selected="selected">3D-Force-Directed</option> |
| 72 | + <option>Sphere Graph</option> |
| 73 | + </select> |
| 74 | + </p> |
| 75 | + <p> |
| 76 | + <input type="checkbox" id="show_labels"> |
| 77 | + <label for="show_labels">Show labels</label> |
| 78 | + </p> |
| 79 | + <p> |
| 80 | + <input type="button" value="Stop layout" onclick="drawing.stop_calculating();"> |
| 81 | + </p> |
| 82 | + </form> |
| 83 | + </div> |
| 84 | + |
35 | 85 | <div style="position: absolute; bottom: 0;">
|
36 | 86 | Rotate: Left Mouse Button and Move<br />
|
37 |
| - Zoom: Left Mouse Button + Key S and Move<br /> |
38 |
| - Drag: Left Mouse Button + Key D and Move |
39 |
| - </div> |
| 87 | + Zoom: Press Key S + Left Mouse Button and Move<br /> |
| 88 | + Drag: Press Key D + Left Mouse Button and Move |
| 89 | + </div> |
40 | 90 | </body>
|
41 | 91 | </html>
|
0 commit comments