line-scatter.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 &amp; scatter</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: 'Points',
  54. type: 'scatter',
  55. //2.14, 2.15, 3.61, 4.93, 2.4, 2.7, 4.2, 5.4, 6.1, 8.3
  56. data: [{
  57. x: 1,
  58. y: 2.14
  59. }, {
  60. x: 1.2,
  61. y: 2.19
  62. }, {
  63. x: 1.8,
  64. y: 2.43
  65. }, {
  66. x: 2.3,
  67. y: 3.8
  68. }, {
  69. x: 2.6,
  70. y: 4.14
  71. }, {
  72. x: 2.9,
  73. y: 5.4
  74. }, {
  75. x: 3.2,
  76. y: 5.8
  77. }, {
  78. x: 3.8,
  79. y: 6.04
  80. }, {
  81. x: 4.55,
  82. y: 6.77
  83. }, {
  84. x: 4.9,
  85. y: 8.1
  86. }, {
  87. x: 5.1,
  88. y: 9.4
  89. }, {
  90. x: 7.1,
  91. y: 7.14
  92. },{
  93. x: 9.18,
  94. y: 8.4
  95. }]
  96. }, {
  97. name: 'Line',
  98. type: 'line',
  99. data: [{
  100. x: 1,
  101. y: 2
  102. }, {
  103. x: 2,
  104. y: 3
  105. }, {
  106. x: 3,
  107. y: 4
  108. }, {
  109. x: 4,
  110. y: 5
  111. }, {
  112. x: 5,
  113. y: 6
  114. }, {
  115. x: 6,
  116. y: 7
  117. }, {
  118. x: 7,
  119. y: 8
  120. }, {
  121. x: 8,
  122. y: 9
  123. }, {
  124. x: 9,
  125. y: 10
  126. }, {
  127. x: 10,
  128. y: 11
  129. }]
  130. }],
  131. chartOptions: {
  132. chart: {
  133. height: 350,
  134. type: 'line',
  135. },
  136. fill: {
  137. type:'solid',
  138. },
  139. markers: {
  140. size: [6, 0]
  141. },
  142. tooltip: {
  143. shared: false,
  144. intersect: true,
  145. },
  146. legend: {
  147. show: false
  148. },
  149. xaxis: {
  150. type: 'numeric',
  151. min: 0,
  152. max: 12,
  153. tickAmount: 12
  154. }
  155. },
  156. },
  157. })
  158. </script>
  159. </body>
  160. </html>