Browse Source

Merge branch 'master' of https://github.com/jrtechs/github-graphs

pull/11/head
Alex Noel 5 years ago
parent
commit
b10962b9d2
29 changed files with 54616 additions and 0 deletions
  1. +44
    -0
      GraphTest.html
  2. +125
    -0
      js/friendsGraph.js
  3. +0
    -0
      js/githubAPI.js
  4. BIN
      js/vis/img/network/acceptDeleteIcon.png
  5. BIN
      js/vis/img/network/addNodeIcon.png
  6. BIN
      js/vis/img/network/backIcon.png
  7. BIN
      js/vis/img/network/connectIcon.png
  8. BIN
      js/vis/img/network/cross.png
  9. BIN
      js/vis/img/network/cross2.png
  10. BIN
      js/vis/img/network/deleteIcon.png
  11. BIN
      js/vis/img/network/downArrow.png
  12. BIN
      js/vis/img/network/editIcon.png
  13. BIN
      js/vis/img/network/leftArrow.png
  14. BIN
      js/vis/img/network/minus.png
  15. BIN
      js/vis/img/network/plus.png
  16. BIN
      js/vis/img/network/rightArrow.png
  17. BIN
      js/vis/img/network/upArrow.png
  18. BIN
      js/vis/img/network/zoomExtends.png
  19. +34
    -0
      js/vis/vis-graph3d.min.js
  20. +1
    -0
      js/vis/vis-network.min.css
  21. +42
    -0
      js/vis/vis-network.min.js
  22. +1
    -0
      js/vis/vis-timeline-graph2d.min.css
  23. +40
    -0
      js/vis/vis-timeline-graph2d.min.js
  24. +1448
    -0
      js/vis/vis.css
  25. +52833
    -0
      js/vis/vis.js
  26. +0
    -0
      js/vis/vis.js.map
  27. +1
    -0
      js/vis/vis.map
  28. +1
    -0
      js/vis/vis.min.css
  29. +46
    -0
      js/vis/vis.min.js

+ 44
- 0
GraphTest.html View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
body {
font: 10pt arial;
}
#myGraph {
width: 800px;
height: 800px;
border: 1px solid lightgray;
background-color:#333333;
}
</style>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>
<script src="js/githubAPI.js"></script>
<script src="js/friendsGraph.js"></script>
<script type="text/javascript" src="js/vis/vis.js"></script>
<link href="js/vis/vis-network.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2 id="graphLabel"></h2>
<div id="myGraph" style="width:100%"></div>
<script>
createFriendsGraph("jrtechs", "myGraph", "graphLabel");
</script>
</body>
</html>

+ 125
- 0
js/friendsGraph.js View File

@ -0,0 +1,125 @@
var nodes;
var edges;
const options = {
nodes: {
borderWidth:4,
size:30,
color: {
border: '#222222',
background: '#666666'
},
font:{color:'#eeeeee'}
},
edges: {
color: 'lightgray'
}
};
function alreadyInGraph(userID)
{
for(var i = 0; i < nodes.length; i++)
{
if(nodes[i].id === userID)
{
return true;
}
}
return false;
}
function addPersonToGraph(profileData)
{
nodes.push(
{
id:profileData.id,
shape: 'circularImage',
image:profileData.avatar_url
});
}
function addFriends(username, apiPath)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser(apiPath, username, function(data)
{
for(var i = 0; i < data.length; i++)
{
if(!alreadyInGraph(data[i].id))
{
addPersonToGraph(data[i]);
}
}
resolve();
},
function(error)
{
reject(error);
})
});
}
function createConnections()
{
return new Promise(function(resolve, reject)
{
resolve();
});
}
function addSelfToGraph(username)
{
return new Promise(function(resolve, reject)
{
queryAPIByUser("", username, function(data)
{
addPersonToGraph(data);
resolve();
},
function(error)
{
reject(error);
});
});
}
function createFriendsGraph(username, containerName, graphsTitle)
{
nodes = [];
edges = [];
addSelfToGraph(username).then(function()
{
addFriends(username, API_FOLLOWERS).then(function()
{
addFriends(username, API_FOLLOWING).then(function()
{
createConnections().then(function()
{
var container = document.getElementById(containerName);
var data =
{
nodes: nodes,
edges: edges
};
var network = new vis.Network(container, data, options);
});
});
})
}).catch(function(error)
{
console.log(error);
$("#" + graphsTitle).html("Error Fetching Data From API");
});
}

githubAPI.js → js/githubAPI.js View File


BIN
js/vis/img/network/acceptDeleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/addNodeIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/backIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/connectIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/cross.png View File

Before After
Width: 7  |  Height: 7  |  Size: 18 KiB

BIN
js/vis/img/network/cross2.png View File

Before After
Width: 5  |  Height: 5  |  Size: 17 KiB

BIN
js/vis/img/network/deleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/downArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/editIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
js/vis/img/network/leftArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/minus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.0 KiB

BIN
js/vis/img/network/plus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.2 KiB

BIN
js/vis/img/network/rightArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/upArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
js/vis/img/network/zoomExtends.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

+ 34
- 0
js/vis/vis-graph3d.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
js/vis/vis-network.min.css
File diff suppressed because it is too large
View File


+ 42
- 0
js/vis/vis-network.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
js/vis/vis-timeline-graph2d.min.css
File diff suppressed because it is too large
View File


+ 40
- 0
js/vis/vis-timeline-graph2d.min.js
File diff suppressed because it is too large
View File


+ 1448
- 0
js/vis/vis.css
File diff suppressed because it is too large
View File


+ 52833
- 0
js/vis/vis.js
File diff suppressed because it is too large
View File


+ 0
- 0
js/vis/vis.js.map View File


+ 1
- 0
js/vis/vis.map
File diff suppressed because it is too large
View File


+ 1
- 0
js/vis/vis.min.css
File diff suppressed because it is too large
View File


+ 46
- 0
js/vis/vis.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save