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.

127 lines
3.5 KiB

  1. <html>
  2. <head>
  3. <title>Timeline demo</title>
  4. <script type="text/javascript" src="../timeline.js"></script>
  5. <link rel="stylesheet" type="text/css" href="../timeline.css">
  6. <style type="text/css">
  7. body {
  8. font: 14pt arial;
  9. }
  10. input {
  11. font: 14pt arial;
  12. }
  13. /* custom styles for individual items, load this after timeline.css */
  14. div.green {
  15. background-color: greenyellow;
  16. border-color: green;
  17. }
  18. /* create a custom sized dot at the bottom of the red item */
  19. div.red {
  20. background-color: red;
  21. border-color: darkred;
  22. color: white;
  23. font-family: monospace;
  24. box-shadow: 0 0 10px gray;
  25. }
  26. div.timeline-event-dot.red {
  27. border-radius: 10px;
  28. border-width: 10px;
  29. }
  30. div.timeline-event-line.red {
  31. border-width: 5px;
  32. }
  33. div.timeline-event-box.red {
  34. border-radius: 0;
  35. border-width: 2px;
  36. font-size: 24pt;
  37. font-weight: bold;
  38. }
  39. div.orange {
  40. background-color: gold;
  41. border-color: orange;
  42. }
  43. div.timeline-event-selected.orange {
  44. /* custom colors for selected orange items */
  45. background-color: orange;
  46. border-color: orangered;
  47. }
  48. div.magenta {
  49. background-color: magenta;
  50. border-color: purple;
  51. color: white;
  52. }
  53. /* our custom classes overrule the styles for selected events,
  54. so lets define a new style for the selected events */
  55. div.timeline-event-selected {
  56. background-color: white;
  57. border-color: black;
  58. color: black;
  59. box-shadow: 0 0 10px gray;
  60. }
  61. </style>
  62. <script type="text/javascript">
  63. var timeline;
  64. var data;
  65. // Called when the page is loaded
  66. function drawVisualization() {
  67. // Create and populate a data table.
  68. data = [
  69. {
  70. 'start': new Date(2012,7,19),
  71. 'content': 'default'
  72. },
  73. {
  74. 'start': new Date(2012,7,23),
  75. 'content': 'green',
  76. 'className': 'green'
  77. },
  78. {
  79. 'start': new Date(2012,7,29),
  80. 'content': 'red',
  81. 'className': 'red'
  82. },
  83. {
  84. 'start': new Date(2012,7,27),
  85. 'end': new Date(2012,8,1),
  86. 'content': 'orange',
  87. 'className': 'orange'
  88. },
  89. {
  90. 'start': new Date(2012,8,2),
  91. 'content': 'magenta',
  92. 'className': 'magenta'
  93. }
  94. ];
  95. // specify options
  96. var options = {
  97. //'editable': true
  98. };
  99. // Instantiate our table object.
  100. timeline = new links.Timeline(document.getElementById('mytimeline'), options);
  101. // Draw our table with the data we created locally.
  102. timeline.draw(data);
  103. }
  104. </script>
  105. </head>
  106. <body onload="drawVisualization()">
  107. <p>This page demonstrates the timeline visualization with custom css classes
  108. for individual items.</p>
  109. <div id="mytimeline"></div>
  110. </body>
  111. </html>