Skip to content

Commit

Permalink
Merge 81f263b into 7139b21
Browse files Browse the repository at this point in the history
  • Loading branch information
totallynotvaishnav committed Jun 15, 2022
2 parents 7139b21 + 81f263b commit f1c72b5
Show file tree
Hide file tree
Showing 71 changed files with 3,728 additions and 14 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ Build powerful and interoperable visualizations without losing flexibility!

**This library is still in early stages, feedback and contributions are very welcome**.

### Install
### Install and run demo examples

```
npm install
npm run start
npm run build
yarn install
yarn build
yarn start
```

### Arguments
Expand Down
1 change: 1 addition & 0 deletions examples/data/airplaneRouteMap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"NetworkGraph","label":"Ninux Roma","protocol":"OLSR","version":"0.6.6.2","metric":"ETX","date":"2019-04-03T05:06:54.000Z","nodes":[{"id":"上海","name":"上海","location":{"lng":121.4648,"lat":31.2891}},{"id":"东莞","name":"东莞","location":{"lng":113.8953,"lat":22.901}},{"id":"东营","name":"东营","location":{"lng":118.7073,"lat":37.5513}},{"id":"中山","name":"中山","location":{"lng":113.4229,"lat":22.478}},{"id":"临汾","name":"临汾","location":{"lng":111.4783,"lat":36.1615}},{"id":"临沂","name":"临沂","location":{"lng":118.3118,"lat":35.2936}},{"id":"丹东","name":"丹东","location":{"lng":124.541,"lat":40.4242}},{"id":"丽水","name":"丽水","location":{"lng":119.5642,"lat":28.1854}},{"id":"乌鲁木齐","name":"乌鲁木齐","location":{"lng":87.9236,"lat":43.5883}},{"id":"佛山","name":"佛山","location":{"lng":112.8955,"lat":23.1097}},{"id":"保定","name":"保定","location":{"lng":115.0488,"lat":39.0948}},{"id":"兰州","name":"兰州","location":{"lng":103.5901,"lat":36.3043}},{"id":"包头","name":"包头","location":{"lng":110.3467,"lat":41.4899}},{"id":"北京","name":"北京","location":{"lng":116.4551,"lat":40.2539}},{"id":"北海","name":"北海","location":{"lng":109.314,"lat":21.6211}},{"id":"南京","name":"南京","location":{"lng":118.8062,"lat":31.9208}},{"id":"南宁","name":"南宁","location":{"lng":108.479,"lat":23.1152}},{"id":"南昌","name":"南昌","location":{"lng":116.0046,"lat":28.6633}},{"id":"南通","name":"南通","location":{"lng":121.1023,"lat":32.1625}},{"id":"厦门","name":"厦门","location":{"lng":118.1689,"lat":24.6478}},{"id":"台州","name":"台州","location":{"lng":121.1353,"lat":28.6688}},{"id":"合肥","name":"合肥","location":{"lng":117.29,"lat":32.0581}},{"id":"呼和浩特","name":"呼和浩特","location":{"lng":111.4124,"lat":40.4901}},{"id":"咸阳","name":"咸阳","location":{"lng":108.4131,"lat":34.8706}},{"id":"哈尔滨","name":"哈尔滨","location":{"lng":127.9688,"lat":45.368}},{"id":"唐山","name":"唐山","location":{"lng":118.4766,"lat":39.6826}},{"id":"嘉兴","name":"嘉兴","location":{"lng":120.9155,"lat":30.6354}},{"id":"大同","name":"大同","location":{"lng":113.7854,"lat":39.8035}},{"id":"大连","name":"大连","location":{"lng":122.2229,"lat":39.4409}},{"id":"天津","name":"天津","location":{"lng":117.4219,"lat":39.4189}},{"id":"太原","name":"太原","location":{"lng":112.3352,"lat":37.9413}},{"id":"威海","name":"威海","location":{"lng":121.9482,"lat":37.1393}},{"id":"宁波","name":"宁波","location":{"lng":121.5967,"lat":29.6466}},{"id":"宝鸡","name":"宝鸡","location":{"lng":107.1826,"lat":34.3433}},{"id":"宿迁","name":"宿迁","location":{"lng":118.5535,"lat":33.7775}},{"id":"常州","name":"常州","location":{"lng":119.4543,"lat":31.5582}},{"id":"广州","name":"广州","location":{"lng":113.5107,"lat":23.2196}},{"id":"廊坊","name":"廊坊","location":{"lng":116.521,"lat":39.0509}},{"id":"延安","name":"延安","location":{"lng":109.1052,"lat":36.4252}},{"id":"张家口","name":"张家口","location":{"lng":115.1477,"lat":40.8527}},{"id":"徐州","name":"徐州","location":{"lng":117.5208,"lat":34.3268}},{"id":"德州","name":"德州","location":{"lng":116.6858,"lat":37.2107}},{"id":"惠州","name":"惠州","location":{"lng":114.6204,"lat":23.1647}},{"id":"成都","name":"成都","location":{"lng":103.9526,"lat":30.7617}},{"id":"扬州","name":"扬州","location":{"lng":119.4653,"lat":32.8162}},{"id":"承德","name":"承德","location":{"lng":117.5757,"lat":41.4075}},{"id":"拉萨","name":"拉萨","location":{"lng":91.1865,"lat":30.1465}},{"id":"无锡","name":"无锡","location":{"lng":120.3442,"lat":31.5527}},{"id":"日照","name":"日照","location":{"lng":119.2786,"lat":35.5023}},{"id":"昆明","name":"昆明","location":{"lng":102.9199,"lat":25.4663}},{"id":"杭州","name":"杭州","location":{"lng":119.5313,"lat":29.8773}},{"id":"枣庄","name":"枣庄","location":{"lng":117.323,"lat":34.8926}},{"id":"柳州","name":"柳州","location":{"lng":109.3799,"lat":24.9774}},{"id":"株洲","name":"株洲","location":{"lng":113.5327,"lat":27.0319}},{"id":"武汉","name":"武汉","location":{"lng":114.3896,"lat":30.6628}},{"id":"汕头","name":"汕头","location":{"lng":117.1692,"lat":23.3405}},{"id":"江门","name":"江门","location":{"lng":112.6318,"lat":22.1484}},{"id":"沈阳","name":"沈阳","location":{"lng":123.1238,"lat":42.1216}},{"id":"沧州","name":"沧州","location":{"lng":116.8286,"lat":38.2104}},{"id":"河源","name":"河源","location":{"lng":114.917,"lat":23.9722}},{"id":"泉州","name":"泉州","location":{"lng":118.3228,"lat":25.1147}},{"id":"泰安","name":"泰安","location":{"lng":117.0264,"lat":36.0516}},{"id":"泰州","name":"泰州","location":{"lng":120.0586,"lat":32.5525}},{"id":"济南","name":"济南","location":{"lng":117.1582,"lat":36.8701}},{"id":"济宁","name":"济宁","location":{"lng":116.8286,"lat":35.3375}},{"id":"海口","name":"海口","location":{"lng":110.3893,"lat":19.8516}},{"id":"淄博","name":"淄博","location":{"lng":118.0371,"lat":36.6064}},{"id":"淮安","name":"淮安","location":{"lng":118.927,"lat":33.4039}},{"id":"深圳","name":"深圳","location":{"lng":114.5435,"lat":22.5439}},{"id":"清远","name":"清远","location":{"lng":112.9175,"lat":24.3292}},{"id":"温州","name":"温州","location":{"lng":120.498,"lat":27.8119}},{"id":"渭南","name":"渭南","location":{"lng":109.7864,"lat":35.0299}},{"id":"湖州","name":"湖州","location":{"lng":119.8608,"lat":30.7782}},{"id":"湘潭","name":"湘潭","location":{"lng":112.5439,"lat":27.7075}},{"id":"滨州","name":"滨州","location":{"lng":117.8174,"lat":37.4963}},{"id":"潍坊","name":"潍坊","location":{"lng":119.0918,"lat":36.524}},{"id":"烟台","name":"烟台","location":{"lng":120.7397,"lat":37.5128}},{"id":"玉溪","name":"玉溪","location":{"lng":101.9312,"lat":23.8898}},{"id":"珠海","name":"珠海","location":{"lng":113.7305,"lat":22.1155}},{"id":"盐城","name":"盐城","location":{"lng":120.2234,"lat":33.5577}},{"id":"盘锦","name":"盘锦","location":{"lng":121.9482,"lat":41.0449}},{"id":"石家庄","name":"石家庄","location":{"lng":114.4995,"lat":38.1006}},{"id":"福州","name":"福州","location":{"lng":119.4543,"lat":25.9222}},{"id":"秦皇岛","name":"秦皇岛","location":{"lng":119.2126,"lat":40.0232}},{"id":"绍兴","name":"绍兴","location":{"lng":120.564,"lat":29.7565}},{"id":"聊城","name":"聊城","location":{"lng":115.9167,"lat":36.4032}},{"id":"肇庆","name":"肇庆","location":{"lng":112.1265,"lat":23.5822}},{"id":"舟山","name":"舟山","location":{"lng":122.2559,"lat":30.2234}},{"id":"苏州","name":"苏州","location":{"lng":120.6519,"lat":31.3989}},{"id":"莱芜","name":"莱芜","location":{"lng":117.6526,"lat":36.2714}},{"id":"菏泽","name":"菏泽","location":{"lng":115.6201,"lat":35.2057}},{"id":"营口","name":"营口","location":{"lng":122.4316,"lat":40.4297}},{"id":"葫芦岛","name":"葫芦岛","location":{"lng":120.1575,"lat":40.578}},{"id":"衡水","name":"衡水","location":{"lng":115.8838,"lat":37.7161}},{"id":"衢州","name":"衢州","location":{"lng":118.6853,"lat":28.8666}},{"id":"西宁","name":"西宁","location":{"lng":101.4038,"lat":36.8207}},{"id":"西安","name":"西安","location":{"lng":109.1162,"lat":34.2004}},{"id":"贵阳","name":"贵阳","location":{"lng":106.6992,"lat":26.7682}},{"id":"连云港","name":"连云港","location":{"lng":119.1248,"lat":34.552}},{"id":"邢台","name":"邢台","location":{"lng":114.8071,"lat":37.2821}},{"id":"邯郸","name":"邯郸","location":{"lng":114.4775,"lat":36.535}},{"id":"郑州","name":"郑州","location":{"lng":113.4668,"lat":34.6234}},{"id":"鄂尔多斯","name":"鄂尔多斯","location":{"lng":108.9734,"lat":39.2487}},{"id":"重庆","name":"重庆","location":{"lng":107.7539,"lat":30.1904}},{"id":"金华","name":"金华","location":{"lng":120.0037,"lat":29.1028}},{"id":"铜川","name":"铜川","location":{"lng":109.0393,"lat":35.1947}},{"id":"银川","name":"银川","location":{"lng":106.3586,"lat":38.1775}},{"id":"镇江","name":"镇江","location":{"lng":119.4763,"lat":31.9702}},{"id":"长春","name":"长春","location":{"lng":125.8154,"lat":44.2584}},{"id":"长沙","name":"长沙","location":{"lng":113.0823,"lat":28.2568}},{"id":"长治","name":"长治","location":{"lng":112.8625,"lat":36.4746}},{"id":"阳泉","name":"阳泉","location":{"lng":113.4778,"lat":38.0951}},{"id":"青岛","name":"青岛","location":{"lng":120.4651,"lat":36.3373}},{"id":"韶关","name":"韶关","location":{"lng":113.7964,"lat":24.7028}}],"links":[{"source":"北京","target":"上海","cost":95},{"source":"北京","target":"广州","cost":90},{"source":"北京","target":"大连","cost":80},{"source":"北京","target":"南宁","cost":70},{"source":"北京","target":"南昌","cost":60},{"source":"北京","target":"拉萨","cost":50},{"source":"北京","target":"长春","cost":40},{"source":"北京","target":"包头","cost":30},{"source":"北京","target":"重庆","cost":20},{"source":"北京","target":"常州","cost":10},{"source":"上海","target":"包头","cost":95},{"source":"上海","target":"昆明","cost":90},{"source":"上海","target":"广州","cost":80},{"source":"上海","target":"郑州","cost":70},{"source":"上海","target":"长春","cost":60},{"source":"上海","target":"重庆","cost":50},{"source":"上海","target":"长沙","cost":40},{"source":"上海","target":"北京","cost":30},{"source":"上海","target":"丹东","cost":20},{"source":"上海","target":"大连","cost":10},{"source":"广州","target":"福州","cost":95},{"source":"广州","target":"太原","cost":90},{"source":"广州","target":"长春","cost":80},{"source":"广州","target":"重庆","cost":70},{"source":"广州","target":"西安","cost":60},{"source":"广州","target":"成都","cost":50},{"source":"广州","target":"常州","cost":40},{"source":"广州","target":"北京","cost":30},{"source":"广州","target":"北海","cost":20},{"source":"广州","target":"海口","cost":10}]}
44 changes: 44 additions & 0 deletions examples/data/generateNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
let nodeLength = 10000, categoryLength = 10;
let nodes = [], links = [], JSONData = {
"type":"NetworkGraph",
"label":"Ninux Roma",
"protocol":"OLSR",
"version":"0.6.6.2",
"metric":"ETX",
"date":"2019-04-03T05:06:54.000Z",
};

for(let i = 0;i < nodeLength;i++){
let node1 = {
id: i,
category: "category" + parseInt(Math.random() * categoryLength),
name: Math.random().toString(36).slice(2,8),
location: {
lng: Math.random() * 180 - 90,
lat: Math.random() * 360,
}
}, node2 = {
id: nodeLength + i,
category: "category" + parseInt(Math.random() * categoryLength),
name: Math.random().toString(36).slice(2, 8),
location: {
lng: Math.random() * 180 - 90,
lat: Math.random() * 360,
}
};

let link = {
source: node1.id,
target: node2.id,
cost: Math.random() * 10,
}

nodes.push(node1, node2);
links.push(link);
}

console.log(JSON.stringify({
...JSONData,
nodes,
links
}));
Binary file added examples/data/indoormap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
180 changes: 180 additions & 0 deletions examples/data/netjson-elementsLegend.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"type": "NetworkGraph",
"label": "Custom Attributes Example",
"protocol": "OLSR",
"version": "0.6.6.2",
"revision": "6ec73b8f5213cc740816f2fd2ff93108",
"metric": "ETX",
"router_id": "172.16.146.6",
"nodes": [
{
"id": "172.16.146.99",
"label": "FusolabNAS",
"properties": {
"hostname": "NAS.nnx",
"gateway": false,
"time": "2019-04-03T05:06:54.000Z"
}
},
{
"id": "172.16.146.6",
"label": "Fusolab",
"properties": {
"hostname": "fusolab.nnx",
"gateway": true,
"time": "2019-04-03T04:06:54.000Z"
}
},
{
"id": "172.16.145.2",
"label": "Clauzroma",
"properties": {
"hostname": "clauzroma.nnx",
"gateway": false,
"time": "2019-04-06T04:06:54.000Z"
}
},
{
"id": "172.16.146.4",
"label": "Lux",
"properties": {
"hostname": "lux.nnx"
}
},
{
"id": "172.16.146.1",
"label": "Nino",
"properties": {
"hostname": "nino.nnx",
"gateway": true
}
},
{
"id": "172.16.146.7",
"label": "Nemesis",
"local_addresses": [
"10.40.0.129",
"10.40.0.130",
"10.40.0.131"
],
"properties": {
"hostname": "nemesis.nnx",
"ssh_pub_key": "ba1aed089f9a513cc8e4ae081b935eb6"
}
}
],
"links": [
{
"source": "172.16.146.6",
"target": "172.16.145.2",
"cost": 1.2939453125,
"properties": {
"lq": 0.900,
"nlq": 0.497,
"bitrate": "20 mbit/s",
"type": "fiber",
"time": "2019-04-06T20:06:54.000Z"
}
},
{
"source": "172.16.146.6",
"target": "172.16.146.4",
"cost": 1.10011212,
"properties": {
"lq": 0.940,
"nlq": 0.797,
"bitrate": "40 mbit/s",
"type": "wireless",
"time": "2019-04-06T23:06:54.000Z"
}
},
{
"source": "172.16.146.6",
"target": "172.16.146.1",
"cost": 1.0,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "30 mbit/s",
"type": "vpn"
}
},
{
"source": "172.16.145.2",
"target": "172.16.146.7",
"cost": 12.739,
"properties": {
"lq": 0.345,
"nlq": 0.227,
"bitrate": "1 mbit/s",
"type": "wireless_weak"
}
},
{
"source": "172.16.145.2",
"target": "172.16.146.4",
"cost": 1.1,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "35 mbit/s",
"type": "wireless"
}
},
{
"source": "172.16.146.99",
"target": "172.16.146.6",
"cost": 1.0,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "1000 mbit/s",
"type": "ethernet"
}
},
{
"source": "172.16.146.7",
"target": "172.16.146.6",
"cost": 1.0,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "32 mbit/s",
"type": "fiber"
}
},
{
"source": "172.16.145.2",
"target": "172.16.146.1",
"cost": 1.0,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "29 mbit/s",
"type": "wireless"
}
},
{
"source": "172.16.146.7",
"target": "172.16.146.1",
"cost": 1.0,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "45 mbit/s",
"type": "wireless"
}
},
{
"source": "172.16.146.7",
"target": "172.16.146.4",
"cost": 1.0,
"properties": {
"lq": 1.0,
"nlq": 1.0,
"bitrate": "39 mbit/s",
"type": "fiber"
}
}
]
}
65 changes: 65 additions & 0 deletions examples/data/netjson-multipleInterfaces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"type": "NetworkGraph",
"protocol": "olsrv1",
"version": "0.9.6.2",
"metric": "",
"revision": "olsr.org - 0.9.6.2-git_0000000-hash_f543df4f4fc9a2eb80ee8b63e7b08125",
"router_id": "172.31.1.100",
"nodes": [
{
"id": "172.31.0.5",
"local_addresses": [
"172.31.0.2",
"172.31.0.3",
"172.31.0.4",
"172.31.0.1",
"172.31.0.5"
]
},
{
"id": "172.31.1.100"
},
{
"id": "172.31.2.100",
"local_addresses": [
"172.31.2.1",
"172.31.2.2"
]
},
{
"id": "172.31.3.100"
},
{
"id": "172.31.4.100"
},
{
"id": "172.31.5.100"
}
],
"links": [
{
"source": "172.31.2.1",
"target": "172.31.0.1",
"cost": 1,
"cost_text": "1.000"
},
{
"source": "172.31.1.100",
"target": "172.31.0.1",
"cost": 1,
"cost_text": "1.000"
},
{
"source": "172.31.0.1",
"target": "172.31.1.100",
"cost": 1,
"cost_text": "1.000"
},
{
"source": "172.31.2.2",
"target": "172.31.2.1",
"cost": 1,
"cost_text": "1.000"
}
]
}

0 comments on commit f1c72b5

Please sign in to comment.