line-with-image.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 with Image Fill</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. // {
  54. // name: 'Dataset 1',
  55. // data: [20, 31, 14, 40, 12, 55, 13, 13, 9, 19, 20, 41, 36, 62, 60]
  56. // },
  57. {
  58. name: 'Dataset 2',
  59. data: [10, 5, 20, 13, 15, 12, 13, 24, 24, 34, 7, 15, 10, 9, 26]
  60. }
  61. ],
  62. chartOptions: {
  63. chart: {
  64. height: 350,
  65. type: 'line',
  66. },
  67. stroke: {
  68. width: 5,
  69. curve: 'smooth'
  70. },
  71. colors: ['#2e93fa'],
  72. xaxis: {
  73. categories: ['1990', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005'],
  74. labels: {
  75. formatter: function(val) {
  76. return val
  77. }
  78. }
  79. },
  80. title: {
  81. text: 'Line Chart - Image fill',
  82. align: 'left',
  83. style: {
  84. fontSize: "16px",
  85. }
  86. },
  87. fill: {
  88. type: 'image',
  89. image: {
  90. src: [
  91. '../../assets/images/abstract.jpg'
  92. ],
  93. width: 800,
  94. height: 800
  95. },
  96. },
  97. markers: {
  98. size: 0,
  99. opacity: 0,
  100. colors: ['#fff'],
  101. strokeColor: "#2e93fa",
  102. strokeWidth: 2,
  103. hover: {
  104. size: 8,
  105. }
  106. },
  107. yaxis: {
  108. title: {
  109. text: '$ (million)',
  110. },
  111. },
  112. legend: {
  113. position: 'top',
  114. horizontalAlign: 'right',
  115. floating: true,
  116. offsetY: -25,
  117. offsetX: -5
  118. }
  119. },
  120. },
  121. })
  122. </script>
  123. </body>
  124. </html>