area-with-negative.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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>Area with Negative - Stacked</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="area" 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;area&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: 'north',
  54. data: [{
  55. x: 1996,
  56. y: 322
  57. },
  58. {
  59. x: 1997,
  60. y: 324
  61. },
  62. {
  63. x: 1998,
  64. y: 329
  65. },
  66. {
  67. x: 1999,
  68. y: 342
  69. },
  70. {
  71. x: 2000,
  72. y: 348
  73. },
  74. {
  75. x: 2001,
  76. y: 334
  77. },
  78. {
  79. x: 2002,
  80. y: 325
  81. },
  82. {
  83. x: 2003,
  84. y: 316
  85. },
  86. {
  87. x: 2004,
  88. y: 318
  89. },
  90. {
  91. x: 2005,
  92. y: 330
  93. },
  94. {
  95. x: 2006,
  96. y: 355
  97. },
  98. {
  99. x: 2007,
  100. y: 366
  101. },
  102. {
  103. x: 2008,
  104. y: 337
  105. },
  106. {
  107. x: 2009,
  108. y: 352
  109. },
  110. {
  111. x: 2010,
  112. y: 377
  113. },
  114. {
  115. x: 2011,
  116. y: 383
  117. },
  118. {
  119. x: 2012,
  120. y: 344
  121. },
  122. {
  123. x: 2013,
  124. y: 366
  125. },
  126. {
  127. x: 2014,
  128. y: 389
  129. },
  130. {
  131. x: 2015,
  132. y: 334
  133. }
  134. ]
  135. }, {
  136. name: 'south',
  137. data: [
  138. {
  139. x: 1996,
  140. y: 162
  141. },
  142. {
  143. x: 1997,
  144. y: 90
  145. },
  146. {
  147. x: 1998,
  148. y: 50
  149. },
  150. {
  151. x: 1999,
  152. y: 77
  153. },
  154. {
  155. x: 2000,
  156. y: 35
  157. },
  158. {
  159. x: 2001,
  160. y: -45
  161. },
  162. {
  163. x: 2002,
  164. y: -88
  165. },
  166. {
  167. x: 2003,
  168. y: -120
  169. },
  170. {
  171. x: 2004,
  172. y: -156
  173. },
  174. {
  175. x: 2005,
  176. y: -123
  177. },
  178. {
  179. x: 2006,
  180. y: -88
  181. },
  182. {
  183. x: 2007,
  184. y: -66
  185. },
  186. {
  187. x: 2008,
  188. y: -45
  189. },
  190. {
  191. x: 2009,
  192. y: -29
  193. },
  194. {
  195. x: 2010,
  196. y: -45
  197. },
  198. {
  199. x: 2011,
  200. y: -88
  201. },
  202. {
  203. x: 2012,
  204. y: -132
  205. },
  206. {
  207. x: 2013,
  208. y: -146
  209. },
  210. {
  211. x: 2014,
  212. y: -169
  213. },
  214. {
  215. x: 2015,
  216. y: -184
  217. }
  218. ]
  219. }],
  220. chartOptions: {
  221. chart: {
  222. type: 'area',
  223. height: 350
  224. },
  225. dataLabels: {
  226. enabled: false
  227. },
  228. stroke: {
  229. curve: 'straight'
  230. },
  231. title: {
  232. text: 'Area with Negative Values',
  233. align: 'left',
  234. style: {
  235. fontSize: '14px'
  236. }
  237. },
  238. xaxis: {
  239. type: 'datetime',
  240. axisBorder: {
  241. show: false
  242. },
  243. axisTicks: {
  244. show: false
  245. }
  246. },
  247. yaxis: {
  248. tickAmount: 4,
  249. floating: false,
  250. labels: {
  251. style: {
  252. colors: '#8e8da4',
  253. },
  254. offsetY: -7,
  255. offsetX: 0,
  256. },
  257. axisBorder: {
  258. show: false,
  259. },
  260. axisTicks: {
  261. show: false
  262. }
  263. },
  264. fill: {
  265. opacity: 0.5
  266. },
  267. tooltip: {
  268. x: {
  269. format: "yyyy",
  270. },
  271. fixed: {
  272. enabled: false,
  273. position: 'topRight'
  274. }
  275. },
  276. grid: {
  277. yaxis: {
  278. lines: {
  279. offsetX: -30
  280. }
  281. },
  282. padding: {
  283. left: 20
  284. }
  285. }
  286. },
  287. },
  288. })
  289. </script>
  290. </body>
  291. </html>