timeline.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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>Timeline Bar 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. <apexchart type=rangeBar height=350 :options="chartOptions" :series="series" />
  19. </div>
  20. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  21. <div id="html">
  22. &lt;div id="chart">
  23. &lt;apexchart type=rangeBar height=350 :options="chartOptions" :series="series" />
  24. &lt;/div>
  25. </div>
  26. <script src="https://unpkg.com/vue/dist/vue.js"></script>
  27. <script src="https://cdn.jsdelivr.net/npm/apexcharts@latest"></script>
  28. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  29. <script>
  30. new Vue({
  31. el: '#chart',
  32. components: {
  33. apexchart: VueApexCharts,
  34. },
  35. data: {
  36. series: [{
  37. name: 'Bob',
  38. data: [{
  39. x: 'Design',
  40. y: [new Date('2019-03-02').getTime(), new Date('2019-03-03').getTime()]
  41. }, {
  42. x: 'Code',
  43. y: [new Date('2019-03-02').getTime(), new Date('2019-03-04').getTime()]
  44. }, {
  45. x: 'Test',
  46. y: [new Date('2019-03-04').getTime(), new Date('2019-03-07').getTime()]
  47. }, {
  48. x: 'Deployment',
  49. y: [new Date('2019-03-11').getTime(), new Date('2019-03-12').getTime()]
  50. }]
  51. }, {
  52. name: 'Joe',
  53. data: [{
  54. x: 'Design',
  55. y: [new Date('2019-03-01').getTime(), new Date('2019-03-02').getTime()]
  56. }, {
  57. x: 'Code',
  58. y: [new Date('2019-03-03').getTime(), new Date('2019-03-07').getTime()]
  59. }, {
  60. x: 'Test',
  61. y: [new Date('2019-03-06').getTime(), new Date('2019-03-09').getTime()]
  62. }, {
  63. x: 'Deployment',
  64. y: [new Date('2019-03-10').getTime(), new Date('2019-03-11').getTime()]
  65. }]
  66. }],
  67. chartOptions: {
  68. plotOptions: {
  69. bar: {
  70. horizontal: true,
  71. }
  72. },
  73. yaxis: {
  74. min: new Date('2019-03-01').getTime(),
  75. max: new Date('2019-03-14').getTime()
  76. },
  77. xaxis: {
  78. type: 'datetime'
  79. },
  80. fill: {
  81. type: 'gradient',
  82. gradient: {
  83. shade: 'light',
  84. type: "vertical",
  85. shadeIntensity: 0.25,
  86. gradientToColors: undefined,
  87. inverseColors: true,
  88. opacityFrom: 1,
  89. opacityTo: 1,
  90. stops: [50, 0, 100, 100]
  91. }
  92. }
  93. }
  94. }
  95. })
  96. </script>
  97. </body>
  98. </html>