vis.js is a dynamic, browser-based visualization library
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.

83 lines
1.9 KiB

  1. <html>
  2. <head>
  3. <title>Timeline | Bridge</title>
  4. <script src="js/vis/vis.js"></script>
  5. <script src="js/eve.js"></script>
  6. <script src="js/timelineAgent.js"></script>
  7. <link href="js/vis/vis.css" rel="stylesheet" type="text/css" />
  8. <link href="./css/timelineStyle.css" rel="stylesheet" type="text/css" />
  9. </head>
  10. <body>
  11. <p>This page demonstrates the Timeline with custom css classes for individual items.</p>
  12. <div id="mytimeline"></div>
  13. <script type="text/javascript">
  14. var connected = false;
  15. // create data
  16. // note that months are zero-based in the JavaScript Date object
  17. var data = new vis.DataSet();
  18. // called from agent
  19. function addToDataset(item) {
  20. data.add(item);
  21. }
  22. // called from agent
  23. function clearDataset() {
  24. data.clear();
  25. }
  26. function sessionClosed() {
  27. if (connected === true) {
  28. document.getElementById("overlayNC").style.display = 'block';
  29. }
  30. }
  31. // specify options
  32. var options = {
  33. editable: true
  34. };
  35. // to run this, also have webHttp.js running in node.
  36. eve.system.init({
  37. transports: [
  38. {
  39. type: 'ws',
  40. url: 'ws://agents/:id'
  41. },
  42. {
  43. type: 'http'
  44. }
  45. ]
  46. });
  47. var proxyAddress = 'ws://afternoon-beyond-2302.herokuapp.com/agents/proxy';
  48. var proxyAddressHTTP = 'https://afternoon-beyond-2302.herokuapp.com/agents/proxy';
  49. // proxyAddress = 'ws://127.0.0.1:5000/agents/proxy';
  50. // proxyAddressHTTP = 'http://127.0.0.1:5000/agents/proxy';
  51. timelineProxy = new timelineAgent('timelineAgent', proxyAddress);
  52. timelineProxy.wakeProxy(proxyAddressHTTP);
  53. timelineProxy.connectToProxy();
  54. timelineProxy.getTimelineEvents().then(function (reply) {
  55. addToDataset(reply);
  56. }).catch(function (err) {
  57. console.error(err);
  58. });
  59. // create the timeline
  60. var container = document.getElementById('mytimeline');
  61. timeline = new vis.Timeline(container, data, options);
  62. </script>
  63. </body>
  64. </html>