line-scatter.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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/apexcharts"></script>
  30. </head>
  31. <body>
  32. <div id="chart"></div>
  33. <script>
  34. var options = {
  35. series: [{
  36. name: 'Points',
  37. type: 'scatter',
  38. //2.14, 2.15, 3.61, 4.93, 2.4, 2.7, 4.2, 5.4, 6.1, 8.3
  39. data: [{
  40. x: 1,
  41. y: 2.14
  42. }, {
  43. x: 1.2,
  44. y: 2.19
  45. }, {
  46. x: 1.8,
  47. y: 2.43
  48. }, {
  49. x: 2.3,
  50. y: 3.8
  51. }, {
  52. x: 2.6,
  53. y: 4.14
  54. }, {
  55. x: 2.9,
  56. y: 5.4
  57. }, {
  58. x: 3.2,
  59. y: 5.8
  60. }, {
  61. x: 3.8,
  62. y: 6.04
  63. }, {
  64. x: 4.55,
  65. y: 6.77
  66. }, {
  67. x: 4.9,
  68. y: 8.1
  69. }, {
  70. x: 5.1,
  71. y: 9.4
  72. }, {
  73. x: 7.1,
  74. y: 7.14
  75. },{
  76. x: 9.18,
  77. y: 8.4
  78. }]
  79. }, {
  80. name: 'Line',
  81. type: 'line',
  82. data: [{
  83. x: 1,
  84. y: 2
  85. }, {
  86. x: 2,
  87. y: 3
  88. }, {
  89. x: 3,
  90. y: 4
  91. }, {
  92. x: 4,
  93. y: 5
  94. }, {
  95. x: 5,
  96. y: 6
  97. }, {
  98. x: 6,
  99. y: 7
  100. }, {
  101. x: 7,
  102. y: 8
  103. }, {
  104. x: 8,
  105. y: 9
  106. }, {
  107. x: 9,
  108. y: 10
  109. }, {
  110. x: 10,
  111. y: 11
  112. }]
  113. }],
  114. chart: {
  115. height: 350,
  116. type: 'line',
  117. },
  118. fill: {
  119. type:'solid',
  120. },
  121. markers: {
  122. size: [6, 0]
  123. },
  124. tooltip: {
  125. shared: false,
  126. intersect: true,
  127. },
  128. legend: {
  129. show: false
  130. },
  131. xaxis: {
  132. type: 'numeric',
  133. min: 0,
  134. max: 12,
  135. tickAmount: 12
  136. }
  137. };
  138. var chart = new ApexCharts(document.querySelector("#chart"), options);
  139. chart.render();
  140. </script>
  141. </body>
  142. </html>