rangebar.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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>Range 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. <script>
  16. window.Promise ||
  17. document.write(
  18. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  19. )
  20. window.Promise ||
  21. document.write(
  22. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  23. )
  24. window.Promise ||
  25. document.write(
  26. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  27. )
  28. </script>
  29. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  30. </head>
  31. <body>
  32. <div id="chart"></div>
  33. <script>
  34. var options = {
  35. series: [
  36. {
  37. name: 'round-1',
  38. data: [
  39. {
  40. x: ['TEAM', 'A'],
  41. y: 2
  42. },
  43. {
  44. x: ['TEAM', 'B'],
  45. y: 4
  46. },
  47. {
  48. x: ['TEAM', 'C'],
  49. y: 6
  50. },
  51. {
  52. x: ['TEAM', 'D'],
  53. y: 11
  54. }
  55. ]
  56. },
  57. {
  58. name: 'round-2',
  59. data: [
  60. {
  61. x: ['TEAM', 'A'],
  62. y: 4
  63. },
  64. {
  65. x: ['TEAM', 'B'],
  66. y: 1
  67. },
  68. {
  69. x: ['TEAM', 'C'],
  70. y: 9
  71. },
  72. {
  73. x: ['TEAM', 'D'],
  74. y: 3
  75. }
  76. ]
  77. }
  78. ],
  79. chart: {
  80. type: 'bar',
  81. height: 350
  82. },
  83. plotOptions: {
  84. bar: {
  85. horizontal: true
  86. }
  87. },
  88. dataLabels: {
  89. enabled: true
  90. },
  91. yaxis: {
  92. labels: {
  93. align: 'center'
  94. }
  95. },
  96. legend: {
  97. horizontalAlign: 'center'
  98. }
  99. };
  100. var chart = new ApexCharts(document.querySelector("#chart"), options);
  101. chart.render();
  102. </script>
  103. </body>
  104. </html>