scatter-images.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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>Scatter - Image 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-legend {
  15. overflow: hidden !important;
  16. min-height: 17px;
  17. }
  18. .apexcharts-legend-marker {
  19. background: none !important;
  20. margin-right: 7px !important;
  21. }
  22. .apexcharts-legend-series {
  23. align-items: flex-start !important;
  24. }
  25. </style>
  26. <script>
  27. window.Promise ||
  28. document.write(
  29. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  30. )
  31. window.Promise ||
  32. document.write(
  33. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  34. )
  35. window.Promise ||
  36. document.write(
  37. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  38. )
  39. </script>
  40. <script src="https://cdn.jsdelivr.net/npm/react@16.12/umd/react.production.min.js"></script>
  41. <script src="https://cdn.jsdelivr.net/npm/react-dom@16.12/umd/react-dom.production.min.js"></script>
  42. <script src="https://cdn.jsdelivr.net/npm/prop-types@15.7.2/prop-types.min.js"></script>
  43. <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script>
  44. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  45. <script src="https://cdn.jsdelivr.net/npm/react-apexcharts@1.3.6/dist/react-apexcharts.iife.min.js"></script>
  46. <link href="../../assets/styles.css" rel="stylesheet" />
  47. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/brands.css" integrity="sha384-QT2Z8ljl3UupqMtQNmPyhSPO/d5qbrzWmFxJqmY7tqoTuT2YrQLEqzvVOP2cT5XW" crossorigin="anonymous">
  48. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/fontawesome.css" integrity="sha384-u5J7JghGz0qUrmEsWzBQkfvc8nK3fUT7DCaQzNQ+q4oEXhGSx+P2OqjWsfIRB8QT" crossorigin="anonymous">
  49. </head>
  50. <body>
  51. <div id="app"></div>
  52. <div id="html">
  53. &lt;div id=&quot;chart&quot;&gt;
  54. &lt;ReactApexChart options={this.state.options} series={this.state.series} type=&quot;scatter&quot; height={350} /&gt;
  55. &lt;/div&gt;
  56. </div>
  57. <script type="text/babel">
  58. class ApexChart extends React.Component {
  59. constructor(props) {
  60. super(props);
  61. this.state = {
  62. series: [{
  63. name: 'Messenger',
  64. data: [
  65. [16.4, 5.4],
  66. [21.7, 4],
  67. [25.4, 3],
  68. [19, 2],
  69. [10.9, 1],
  70. [13.6, 3.2],
  71. [10.9, 7],
  72. [10.9, 8.2],
  73. [16.4, 4],
  74. [13.6, 4.3],
  75. [13.6, 12],
  76. [29.9, 3],
  77. [10.9, 5.2],
  78. [16.4, 6.5],
  79. [10.9, 8],
  80. [24.5, 7.1],
  81. [10.9, 7],
  82. [8.1, 4.7],
  83. [19, 10],
  84. [27.1, 10],
  85. [24.5, 8],
  86. [27.1, 3],
  87. [29.9, 11.5],
  88. [27.1, 0.8],
  89. [22.1, 2]
  90. ]
  91. }, {
  92. name: 'Instagram',
  93. data: [
  94. [6.4, 5.4],
  95. [11.7, 4],
  96. [15.4, 3],
  97. [9, 2],
  98. [10.9, 11],
  99. [20.9, 7],
  100. [12.9, 8.2],
  101. [6.4, 14],
  102. [11.6, 12]
  103. ]
  104. }],
  105. options: {
  106. chart: {
  107. height: 350,
  108. type: 'scatter',
  109. animations: {
  110. enabled: false,
  111. },
  112. zoom: {
  113. enabled: false,
  114. },
  115. toolbar: {
  116. show: false
  117. }
  118. },
  119. colors: ['#056BF6', '#D2376A'],
  120. xaxis: {
  121. tickAmount: 10,
  122. min: 0,
  123. max: 40
  124. },
  125. yaxis: {
  126. tickAmount: 7
  127. },
  128. markers: {
  129. size: 20
  130. },
  131. fill: {
  132. type: 'image',
  133. opacity: 1,
  134. image: {
  135. src: ['../../assets/images/ico-messenger.png', '../../assets/images/ico-instagram.png'],
  136. width: 40,
  137. height: 40
  138. }
  139. },
  140. legend: {
  141. labels: {
  142. useSeriesColors: true
  143. },
  144. markers: {
  145. customHTML: [
  146. function() {
  147. return '<span><i class="fab fa-facebook"></i></span>'
  148. }, function() {
  149. return '<span><i class="fab fa-instagram"></i></span>'
  150. }
  151. ]
  152. }
  153. }
  154. },
  155. };
  156. }
  157. render() {
  158. return (
  159. <div>
  160. <div id="chart">
  161. <ReactApexChart options={this.state.options} series={this.state.series} type="scatter" height={350} />
  162. </div>
  163. <div id="html-dist"></div>
  164. </div>
  165. );
  166. }
  167. }
  168. const domContainer = document.querySelector('#app');
  169. ReactDOM.render(React.createElement(ApexChart), domContainer);
  170. </script>
  171. </body>
  172. </html>