distributed-columns.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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>Distributed Bar</title>
  8. <link href="../../assets/styles.css" rel="stylesheet" />
  9. <style>
  10. #chart {
  11. max-width: 650px;
  12. margin: 35px auto;
  13. }
  14. #chart .apexcharts-xaxis-label {
  15. font-weight: bold;
  16. }
  17. </style>
  18. <script>
  19. window.Promise ||
  20. document.write(
  21. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  22. )
  23. window.Promise ||
  24. document.write(
  25. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  26. )
  27. window.Promise ||
  28. document.write(
  29. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  30. )
  31. </script>
  32. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  33. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  34. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  35. <script>
  36. var colors = [
  37. '#008FFB',
  38. '#00E396',
  39. '#FEB019',
  40. '#FF4560',
  41. '#775DD0',
  42. '#546E7A',
  43. '#26a69a',
  44. '#D10CE8'
  45. ]
  46. </script>
  47. </head>
  48. <body>
  49. <div id="app">
  50. <div id="chart">
  51. <apexchart type="bar" height="350" :options="chartOptions" :series="series"></apexchart>
  52. </div>
  53. </div>
  54. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  55. <div id="html">
  56. &lt;div id=&quot;chart&quot;&gt;
  57. &lt;apexchart type=&quot;bar&quot; height=&quot;350&quot; :options=&quot;chartOptions&quot; :series=&quot;series&quot;&gt;&lt;/apexchart&gt;
  58. &lt;/div&gt;
  59. </div>
  60. <script>
  61. new Vue({
  62. el: '#app',
  63. components: {
  64. apexchart: VueApexCharts,
  65. },
  66. data: {
  67. series: [{
  68. data: [21, 22, 10, 28, 16, 21, 13, 30]
  69. }],
  70. chartOptions: {
  71. chart: {
  72. height: 350,
  73. type: 'bar',
  74. events: {
  75. click: function(chart, w, e) {
  76. // console.log(chart, w, e)
  77. }
  78. }
  79. },
  80. colors: colors,
  81. plotOptions: {
  82. bar: {
  83. columnWidth: '45%',
  84. distributed: true
  85. }
  86. },
  87. dataLabels: {
  88. enabled: false
  89. },
  90. legend: {
  91. show: false
  92. },
  93. xaxis: {
  94. categories: [
  95. ['John', 'Doe'],
  96. ['Joe', 'Smith'],
  97. ['Jake', 'Williams'],
  98. 'Amber',
  99. ['Peter', 'Brown'],
  100. ['Mary', 'Evans'],
  101. ['David', 'Wilson'],
  102. ['Lily', 'Roberts'],
  103. ],
  104. labels: {
  105. style: {
  106. colors: colors,
  107. fontSize: '12px'
  108. }
  109. }
  110. }
  111. },
  112. },
  113. })
  114. </script>
  115. </body>
  116. </html>