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.

117 lines
2.6 KiB

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