multiple-yaxes.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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>Multiple Y Axis Chart</title>
  8. <link href="../../assets/styles.css" rel="stylesheet" />
  9. <style>
  10. #chart {
  11. max-width: 650px;
  12. margin: 35px auto;
  13. }
  14. .apexcharts-tooltip-title {
  15. display: none;
  16. }
  17. #chart .apexcharts-tooltip {
  18. display: flex;
  19. border: 0;
  20. box-shadow: none;
  21. }
  22. </style>
  23. <script>
  24. window.Promise ||
  25. document.write(
  26. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  27. )
  28. window.Promise ||
  29. document.write(
  30. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  31. )
  32. window.Promise ||
  33. document.write(
  34. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  35. )
  36. </script>
  37. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  38. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  39. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  40. </head>
  41. <body>
  42. <div id="app">
  43. <div id="chart">
  44. <apexchart type="line" height="350" :options="chartOptions" :series="series"></apexchart>
  45. </div>
  46. </div>
  47. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  48. <div id="html">
  49. &lt;div id=&quot;chart&quot;&gt;
  50. &lt;apexchart type=&quot;line&quot; height=&quot;350&quot; :options=&quot;chartOptions&quot; :series=&quot;series&quot;&gt;&lt;/apexchart&gt;
  51. &lt;/div&gt;
  52. </div>
  53. <script>
  54. new Vue({
  55. el: '#app',
  56. components: {
  57. apexchart: VueApexCharts,
  58. },
  59. data: {
  60. series: [{
  61. name: 'Income',
  62. type: 'column',
  63. data: [1.4, 2, 2.5, 1.5, 2.5, 2.8, 3.8, 4.6]
  64. }, {
  65. name: 'Cashflow',
  66. type: 'column',
  67. data: [1.1, 3, 3.1, 4, 4.1, 4.9, 6.5, 8.5]
  68. }, {
  69. name: 'Revenue',
  70. type: 'line',
  71. data: [20, 29, 37, 36, 44, 45, 50, 58]
  72. }],
  73. chartOptions: {
  74. chart: {
  75. height: 350,
  76. type: 'line',
  77. stacked: false
  78. },
  79. dataLabels: {
  80. enabled: false
  81. },
  82. stroke: {
  83. width: [1, 1, 4]
  84. },
  85. title: {
  86. text: 'XYZ - Stock Analysis (2009 - 2016)',
  87. align: 'left',
  88. offsetX: 110
  89. },
  90. xaxis: {
  91. categories: [2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016],
  92. },
  93. yaxis: [
  94. {
  95. axisTicks: {
  96. show: true,
  97. },
  98. axisBorder: {
  99. show: true,
  100. color: '#008FFB'
  101. },
  102. labels: {
  103. style: {
  104. colors: '#008FFB',
  105. }
  106. },
  107. title: {
  108. text: "Income (thousand crores)",
  109. style: {
  110. color: '#008FFB',
  111. }
  112. },
  113. tooltip: {
  114. enabled: true
  115. }
  116. },
  117. {
  118. seriesName: 'Income',
  119. opposite: true,
  120. axisTicks: {
  121. show: true,
  122. },
  123. axisBorder: {
  124. show: true,
  125. color: '#00E396'
  126. },
  127. labels: {
  128. style: {
  129. colors: '#00E396',
  130. }
  131. },
  132. title: {
  133. text: "Operating Cashflow (thousand crores)",
  134. style: {
  135. color: '#00E396',
  136. }
  137. },
  138. },
  139. {
  140. seriesName: 'Revenue',
  141. opposite: true,
  142. axisTicks: {
  143. show: true,
  144. },
  145. axisBorder: {
  146. show: true,
  147. color: '#FEB019'
  148. },
  149. labels: {
  150. style: {
  151. colors: '#FEB019',
  152. },
  153. },
  154. title: {
  155. text: "Revenue (thousand crores)",
  156. style: {
  157. color: '#FEB019',
  158. }
  159. }
  160. },
  161. ],
  162. tooltip: {
  163. fixed: {
  164. enabled: true,
  165. position: 'topLeft', // topRight, topLeft, bottomRight, bottomLeft
  166. offsetY: 30,
  167. offsetX: 60
  168. },
  169. },
  170. legend: {
  171. horizontalAlign: 'left',
  172. offsetX: 40
  173. }
  174. },
  175. },
  176. })
  177. </script>
  178. </body>
  179. </html>