line-column-area.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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>Line, Column &amp; Area</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/vue/dist/vue.min.js"></script>
  30. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  31. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  32. </head>
  33. <body>
  34. <div id="app">
  35. <div id="chart">
  36. <apexchart type="line" height="350" :options="chartOptions" :series="series"></apexchart>
  37. </div>
  38. </div>
  39. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  40. <div id="html">
  41. &lt;div id=&quot;chart&quot;&gt;
  42. &lt;apexchart type=&quot;line&quot; height=&quot;350&quot; :options=&quot;chartOptions&quot; :series=&quot;series&quot;&gt;&lt;/apexchart&gt;
  43. &lt;/div&gt;
  44. </div>
  45. <script>
  46. new Vue({
  47. el: '#app',
  48. components: {
  49. apexchart: VueApexCharts,
  50. },
  51. data: {
  52. series: [{
  53. name: 'TEAM A',
  54. type: 'column',
  55. data: [23, 11, 22, 27, 13, 22, 37, 21, 44, 22, 30]
  56. }, {
  57. name: 'TEAM B',
  58. type: 'area',
  59. data: [44, 55, 41, 67, 22, 43, 21, 41, 56, 27, 43]
  60. }, {
  61. name: 'TEAM C',
  62. type: 'line',
  63. data: [30, 25, 36, 30, 45, 35, 64, 52, 59, 36, 39]
  64. }],
  65. chartOptions: {
  66. chart: {
  67. height: 350,
  68. type: 'line',
  69. stacked: false,
  70. },
  71. stroke: {
  72. width: [0, 2, 5],
  73. curve: 'smooth'
  74. },
  75. plotOptions: {
  76. bar: {
  77. columnWidth: '50%'
  78. }
  79. },
  80. fill: {
  81. opacity: [0.85, 0.25, 1],
  82. gradient: {
  83. inverseColors: false,
  84. shade: 'light',
  85. type: "vertical",
  86. opacityFrom: 0.85,
  87. opacityTo: 0.55,
  88. stops: [0, 100, 100, 100]
  89. }
  90. },
  91. labels: ['01/01/2003', '02/01/2003', '03/01/2003', '04/01/2003', '05/01/2003', '06/01/2003', '07/01/2003',
  92. '08/01/2003', '09/01/2003', '10/01/2003', '11/01/2003'
  93. ],
  94. markers: {
  95. size: 0
  96. },
  97. xaxis: {
  98. type: 'datetime'
  99. },
  100. yaxis: {
  101. title: {
  102. text: 'Points',
  103. },
  104. min: 0
  105. },
  106. tooltip: {
  107. shared: true,
  108. intersect: false,
  109. y: {
  110. formatter: function (y) {
  111. if (typeof y !== "undefined") {
  112. return y.toFixed(0) + " points";
  113. }
  114. return y;
  115. }
  116. }
  117. }
  118. },
  119. },
  120. })
  121. </script>
  122. </body>
  123. </html>