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. </head>
  60. <body>
  61. <p>This page demonstrates the Timeline with custom css classes for individual items.</p>
  62. <div id="mytimeline"></div>
  63. <script type="text/javascript">
  64. // create data
  65. // note that months are zero-based in the JavaScript Date object
  66. var data = new vis.DataSet([
  67. {
  68. 'start': new Date(2012,7,19),
  69. 'content': 'default'
  70. },
  71. {
  72. 'start': new Date(2012,7,23),
  73. 'content': 'green',
  74. 'className': 'green'
  75. },
  76. {
  77. 'start': new Date(2012,7,29),
  78. 'content': 'red',
  79. 'className': 'red'
  80. },
  81. {
  82. 'start': new Date(2012,7,27),
  83. 'end': new Date(2012,8,1),
  84. 'content': 'orange',
  85. 'className': 'orange'
  86. },
  87. {
  88. 'start': new Date(2012,8,2),
  89. 'content': 'magenta',
  90. 'className': 'magenta'
  91. }
  92. ]);
  93. // specify options
  94. var options = {
  95. editable: true
  96. };
  97. // create the timeline
  98. var container = document.getElementById('mytimeline');
  99. timeline = new vis.Timeline(container, data, options);
  100. </script>
  101. </body>
  102. </html>