example13_grouping.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <html>
  2. <head>
  3. <title>Timeline demo</title>
  4. <script type="text/javascript" src="http://www.google.com/jsapi"></script>
  5. <script type="text/javascript" src="../timeline.js"></script>
  6. <link rel="stylesheet" type="text/css" href="../timeline.css">
  7. <style>
  8. body {font: 10pt arial;}
  9. div.timeline-frame {
  10. border-color: #103E9C;
  11. }
  12. div.timeline-axis {
  13. border-color: #103E9C;
  14. background-color: #EEEFF1;
  15. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F9F9F9', endColorstr='#EEEFF1'); /* for IE */
  16. background: -webkit-gradient(linear, left top, left bottom, from(#F9F9F9), to(#EEEFF1)); /* for webkit browsers */
  17. background: -moz-linear-gradient(top, #F9F9F9, #EEEFF1); /* for firefox 3.6+ */
  18. }
  19. div.timeline-axis-text {
  20. font: bold 12px arial ;
  21. color: #103E9C;
  22. }
  23. div.timeline-event {
  24. border: none;
  25. background-color: white;
  26. }
  27. div.timeline-event-selected {
  28. background-color: #C0D8E1;
  29. }
  30. div.timeline-event-content {
  31. margin: 0px;
  32. }
  33. div.timeline-groups-axis {
  34. border-color: #103E9C;
  35. }
  36. div.timeline-groups-text {
  37. font: bold 12px arial ;
  38. color: #103E9C;
  39. }
  40. div.order {
  41. border: 1px solid #FB3738;
  42. border-radius: 2px;
  43. -moz-border-radius: 2px;
  44. font: bold 12px arial ;
  45. color: #103E9C;
  46. padding: 2px;
  47. margin:1px;
  48. overflow: hidden;
  49. }
  50. </style>
  51. <script type="text/javascript">
  52. var timeline = null;
  53. google.load("visualization", "1");
  54. // Set callback to run when API is loaded
  55. google.setOnLoadCallback(drawVisualization);
  56. // Called when the Visualization API is loaded.
  57. function drawVisualization() {
  58. // Create and populate a data table.
  59. var data = new google.visualization.DataTable();
  60. data.addColumn('datetime', 'start');
  61. data.addColumn('datetime', 'end');
  62. data.addColumn('string', 'content');
  63. data.addColumn('string', 'group');
  64. var order = 1;
  65. for (var truck = 11; truck < 15; truck++) {
  66. var date = new Date(2010, 12, 14, 8, 0, 0);
  67. for (var i = 0; i < 10; i++) {
  68. date.setHours(date.getHours() + 1 * 4 * (Math.random() < 0.2));
  69. var start = new Date(date);
  70. date.setHours(date.getHours() + 2 + Math.floor(Math.random()*4));
  71. var end = new Date(date);
  72. var orderText = "Order " + order;
  73. if (Math.random() < 0.25)
  74. orderText = "<img src='img/product-icon.png' style='width:32px; height:32px; vertical-align: middle'> " + orderText;
  75. orderText = "<div title='Order " + order + "' class='order'>" + orderText + "</div>";
  76. var truckText = "<img src='img/truck-icon.png' style='width:24px; height:24px; vertical-align: middle'> " +
  77. "Truck " + truck;
  78. data.addRow([start, end, orderText, truckText]);
  79. order++;
  80. }
  81. }
  82. // specify options
  83. var options = {
  84. width: "100%",
  85. //height: "300px",
  86. height: "auto",
  87. layout: "box",
  88. editable: true,
  89. eventMargin: 5, // minimal margin between events
  90. eventMarginAxis: 0, // minimal margin beteen events and the axis
  91. showMajorLabels: false,
  92. axisOnTop: true,
  93. // groupsWidth : "200px",
  94. groupsChangeable : true,
  95. groupsOnRight: false
  96. };
  97. // Instantiate our timeline object.
  98. timeline = new links.Timeline(document.getElementById('mytimeline'));
  99. // Draw our timeline with the created data and options
  100. timeline.draw(data, options);
  101. }
  102. </script>
  103. </head>
  104. <body>
  105. <h1>Grouping example</h1>
  106. <div id="mytimeline"></div>
  107. <!-- Information about where the used icons come from -->
  108. <p style="color:gray; font-size:10px; font-style:italic;">
  109. Icons by <a href="http://dryicons.com" target="_blank" title="Aesthetica 2 Icons by DryIcons" style="color:gray;" >DryIcons</a>
  110. and <a href="http://www.tpdkdesign.net" target="_blank" title="Refresh Cl Icons by TpdkDesign.net" style="color:gray;" >TpdkDesign.net</a>
  111. </p>
  112. </body>
  113. </html>