timeline.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Basic Timeline Chart</title>
  8. <link href="../../assets/styles.css" rel="stylesheet" />
  9. <style>
  10. #chart {
  11. max-width: 650px;
  12. margin: 35px auto;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <div id="chart">
  18. </div>
  19. <script src="https://cdn.jsdelivr.net/npm/apexcharts@latest"></script>
  20. <script>
  21. var options = {
  22. chart: {
  23. height: 350,
  24. type: 'rangeBar',
  25. },
  26. plotOptions: {
  27. bar: {
  28. horizontal: true,
  29. }
  30. },
  31. series: [{
  32. name: 'Bob',
  33. data: [{
  34. x: 'Design',
  35. y: [new Date('2019-03-03').getTime(), new Date('2019-03-05').getTime()]
  36. }, {
  37. x: 'Code',
  38. y: [new Date('2019-03-02').getTime(), new Date('2019-03-04').getTime()]
  39. }, {
  40. x: 'Test',
  41. y: [new Date('2019-03-04').getTime(), new Date('2019-03-07').getTime()]
  42. }, {
  43. x: 'Deployment',
  44. y: [new Date('2019-03-11').getTime(), new Date('2019-03-12').getTime()]
  45. }]
  46. }, {
  47. name: 'Joe',
  48. data: [{
  49. x: 'Design',
  50. y: [new Date('2019-03-02').getTime(), new Date('2019-03-05').getTime()]
  51. }, {
  52. x: 'Code',
  53. y: [new Date('2019-03-03').getTime(), new Date('2019-03-07').getTime()]
  54. }, {
  55. x: 'Test',
  56. y: [new Date('2019-03-06').getTime(), new Date('2019-03-09').getTime()]
  57. }, {
  58. x: 'Deployment',
  59. y: [new Date('2019-03-10').getTime(), new Date('2019-03-11').getTime()]
  60. }, {
  61. x: 'Test',
  62. y: [new Date('2019-03-03').getTime(), new Date('2019-03-05').getTime()]
  63. }, {
  64. x: 'Design',
  65. y: [new Date('2019-03-16').getTime(), new Date('2019-03-21').getTime()]
  66. }]
  67. }],
  68. xaxis: {
  69. type: 'datetime'
  70. },
  71. fill: {
  72. type: 'gradient',
  73. gradient: {
  74. shade: 'light',
  75. type: "vertical",
  76. shadeIntensity: 0.25,
  77. gradientToColors: undefined,
  78. inverseColors: true,
  79. opacityFrom: 1,
  80. opacityTo: 1,
  81. stops: [50, 0, 100, 100]
  82. }
  83. }
  84. }
  85. var chart = new ApexCharts(
  86. document.querySelector("#chart"),
  87. options
  88. );
  89. chart.render();
  90. </script>
  91. </body>
  92. </html>