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.

116 lines
3.0 KiB

  1. <html>
  2. <head>
  3. <title>Timeline | Item class names</title>
  4. <script src="../../dist/vis.js"></script>
  5. <link href="../../dist/vis.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 */
  11. .vis.timeline .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.timeline .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.timeline .item.dot.red {
  24. border-radius: 10px;
  25. border-width: 10px;
  26. }
  27. .vis.timeline .item.line.red {
  28. border-width: 5px;
  29. }
  30. .vis.timeline .item.box.red {
  31. border-radius: 0;
  32. border-width: 2px;
  33. font-size: 24pt;
  34. font-weight: bold;
  35. }
  36. .vis.timeline .item.orange {
  37. background-color: gold;
  38. border-color: orange;
  39. }
  40. .vis.timeline .item.orange.selected {
  41. /* custom colors for selected orange items */
  42. background-color: orange;
  43. border-color: orangered;
  44. }
  45. .vis.timeline .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.timeline .item.selected {
  53. background-color: white;
  54. border-color: black;
  55. color: black;
  56. box-shadow: 0 0 10px gray;
  57. }
  58. </style>
  59. <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></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>