前提・実現したいこと
vis.jsを用いて,jsonから取得したトポロジをrails(4.2.8)上で表示したいです.
特定のノード,リンクに色をつけたいのですが,どうすればいいでしょうか?
該当のソースコード
JSON
1{ 2 "id": 1, 3 "controller_id": 0, 4 "created_at": "2018-09-10T09:15:33.673Z", 5 "updated_at": "2018-09-10T09:15:33.917Z", 6 "graph": { 7 "nodes": [ 8 { 9 "id": 1, 10 "name": "openflow:1", 11 "type": "switch", 12 "ip": null, 13 "mac": null 14 }, 15 { 16 "id": 2, 17 "name": "openflow:2", 18 "type": "switch", 19 "ip": null, 20 "mac": null 21 }, 22 { 23 "id": 3, 24 "name": "openflow:3", 25 "type": "switch", 26 "ip": null, 27 "mac": null 28 }, 29 { 30 "id": 4, 31 "name": "openflow:4", 32 "type": "switch", 33 "ip": null, 34 "mac": null 35 }, 36 { 37 "id": 5, 38 "name": "host:ce:c2:31:25:dd:03", 39 "type": "host", 40 "ip": "10.0.0.1", 41 "mac": "ce:c2:31:25:dd:03" 42 }, 43 { 44 "id": 6, 45 "name": "openflow:5", 46 "type": "switch", 47 "ip": null, 48 "mac": null 49 }, 50 { 51 "id": 7, 52 "name": "openflow:6", 53 "type": "switch", 54 "ip": null, 55 "mac": null 56 }, 57 { 58 "id": 8, 59 "name": "openflow:7", 60 "type": "switch", 61 "ip": null, 62 "mac": null 63 }, 64 { 65 "id": 9, 66 "name": "host:52:de:a3:5e:6d:4d", 67 "type": "host", 68 "ip": "10.0.0.2", 69 "mac": "52:de:a3:5e:6d:4d" 70 } 71 ], 72 "links": [ 73 { 74 "id": 1, 75 "name": "host:ce:c2:31:25:dd:03/openflow:1:3", 76 "src_node_id": 5, 77 "dest_node_id": 1 78 }, 79 { 80 "id": 2, 81 "name": "openflow:7:2", 82 "src_node_id": 8, 83 "dest_node_id": 7 84 }, 85 { 86 "id": 3, 87 "name": "openflow:7:1", 88 "src_node_id": 8, 89 "dest_node_id": 6 90 }, 91 { 92 "id": 4, 93 "name": "openflow:6:1", 94 "src_node_id": 7, 95 "dest_node_id": 4 96 }, 97 { 98 "id": 5, 99 "name": "host:52:de:a3:5e:6d:4d/openflow:7:3", 100 "src_node_id": 9, 101 "dest_node_id": 8 102 }, 103 { 104 "id": 6, 105 "name": "openflow:5:1", 106 "src_node_id": 6, 107 "dest_node_id": 3 108 }, 109 { 110 "id": 7, 111 "name": "openflow:3:2", 112 "src_node_id": 3, 113 "dest_node_id": 2 114 }, 115 { 116 "id": 8, 117 "name": "openflow:4:1", 118 "src_node_id": 4, 119 "dest_node_id": 2 120 }, 121 { 122 "id": 9, 123 "name": "openflow:3:1", 124 "src_node_id": 3, 125 "dest_node_id": 1 126 }, 127 { 128 "id": 10, 129 "name": "openflow:2:1", 130 "src_node_id": 2, 131 "dest_node_id": 1 132 } 133 ] 134 } 135}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。