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.

106 lines
3.0 KiB

  1. <html>
  2. <head>
  3. <title>Timeline clustering demo</title>
  4. <style type="text/css">
  5. body {
  6. font-size: 10pt;
  7. font-family: verdana, sans, arial, sans-serif;
  8. color: #4d4d4d;
  9. }
  10. </style>
  11. <script type="text/javascript" src="../timeline.js"></script>
  12. <link rel="stylesheet" type="text/css" href="../timeline.css">
  13. <script type="text/javascript">
  14. var timeline;
  15. var data;
  16. // Called when the Visualization API is loaded.
  17. function drawVisualization() {
  18. // Create a JSON data table
  19. data = [];
  20. // an item every month
  21. var i, iMax = 1000;
  22. var num = 0;
  23. var date = new Date(2012, 0, 1);
  24. for (i = 0; i < iMax; i++) {
  25. date.setMonth(date.getMonth() + 1);
  26. data.push({
  27. "start": new Date(date),
  28. "content": "item " + num
  29. });
  30. num++;
  31. }
  32. // an item every day
  33. date = new Date(2012, 3, 1);
  34. for (i = 0; i < iMax; i++) {
  35. date.setDate(date.getDate() + 1);
  36. data.push({
  37. "start": new Date(date),
  38. "content": "item " + num
  39. });
  40. num++;
  41. }
  42. // an item every hour
  43. date = new Date(2012, 6, 1);
  44. for (i = 0; i < iMax; i++) {
  45. date.setHours(date.getHours() + 1);
  46. data.push({
  47. "start": new Date(date),
  48. "content": "item " + num
  49. });
  50. num++;
  51. }
  52. // items on the same spot
  53. date = new Date(2012, 9, 1);
  54. for (i = 0; i < iMax; i++) {
  55. data.push({
  56. "start": new Date(date),
  57. "content": "item " + num
  58. });
  59. num++;
  60. }
  61. // specify options
  62. var options = {
  63. 'width': '100%',
  64. 'height': '300px',
  65. 'start': new Date(2012, 0, 1),
  66. 'end': new Date(2012, 11, 31),
  67. 'cluster': true,
  68. // 'axisOnTop': true,
  69. 'editable': true
  70. };
  71. // Instantiate our timeline object.
  72. timeline = new links.Timeline(document.getElementById('mytimeline'), options);
  73. // Draw our timeline with the created data and options
  74. timeline.draw(data);
  75. }
  76. </script>
  77. </head>
  78. <body onload="drawVisualization();">
  79. <h1>Timeline - clustering demo</h1>
  80. <p>
  81. When too much items are being displayed, Timeline will smartly cluster
  82. the items together. This both:
  83. </p>
  84. <ul>
  85. <li>keeps the amount of displayed information limited for the user,</li>
  86. <li>and prevents the browser from getting overloaded</li>
  87. </ul>
  88. <div id="mytimeline"></div>
  89. </body>
  90. </html>