Website for visualizing a persons github network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.0 KiB

  1. var nodes;
  2. var edges;
  3. function addFollowers(username)
  4. {
  5. return new Promise(function(resolve, reject)
  6. {
  7. queryAPIByUser(API_FOLLOWERS, username, function(data)
  8. {
  9. for(var i = 0; i < data.length; i++)
  10. {
  11. nodes.push(
  12. {
  13. id:data[i].id,
  14. shape: 'circularImage',
  15. image:data[i].avatar_url
  16. });
  17. }
  18. resolve();
  19. },
  20. function(error)
  21. {
  22. reject(error);
  23. })
  24. });
  25. }
  26. function addFollowing(username)
  27. {
  28. return new Promise(function(resolve, reject)
  29. {
  30. });
  31. }
  32. function createFriendsGraph(username, containerName, graphsTitle)
  33. {
  34. nodes = [];
  35. edges = [];
  36. var network = null;
  37. addFollowers(username).then(function()
  38. {
  39. var container = document.getElementById(containerName);
  40. var data = {
  41. nodes: nodes,
  42. edges: edges
  43. };
  44. var options = {
  45. nodes: {
  46. borderWidth:4,
  47. size:30,
  48. color: {
  49. border: '#222222',
  50. background: '#666666'
  51. },
  52. font:{color:'#eeeeee'}
  53. },
  54. edges: {
  55. color: 'lightgray'
  56. }
  57. };
  58. network = new vis.Network(container, data, options);
  59. });
  60. // // create connections between people
  61. // // value corresponds with the amount of contact between two people
  62. // edges = [
  63. // {from: 1, to: 2},
  64. // {from: 2, to: 3},
  65. // {from: 2, to: 4},
  66. // {from: 4, to: 5},
  67. // {from: 4, to: 10},
  68. // {from: 4, to: 6},
  69. // {from: 6, to: 7},
  70. // {from: 7, to: 8},
  71. // {from: 8, to: 9},
  72. // {from: 8, to: 10},
  73. // {from: 10, to: 11},
  74. // {from: 11, to: 12},
  75. // {from: 12, to: 13},
  76. // {from: 13, to: 14},
  77. // {from: 9, to: 16}
  78. // ];
  79. }