donut-with-pattern.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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>Donut Chart with pattern</title>
  8. <link href="../../assets/styles.css" rel="stylesheet" />
  9. <style>
  10. #chart {
  11. padding: 0;
  12. max-width: 380px;
  13. margin: 35px auto;
  14. }
  15. </style>
  16. <script>
  17. window.Promise ||
  18. document.write(
  19. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  20. )
  21. window.Promise ||
  22. document.write(
  23. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  24. )
  25. window.Promise ||
  26. document.write(
  27. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  28. )
  29. </script>
  30. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  31. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  32. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  33. </head>
  34. <body>
  35. <div id="app">
  36. <div id="chart">
  37. <apexchart type="donut" width="380" :options="chartOptions" :series="series"></apexchart>
  38. </div>
  39. </div>
  40. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  41. <div id="html">
  42. &lt;div id=&quot;chart&quot;&gt;
  43. &lt;apexchart type=&quot;donut&quot; width=&quot;380&quot; :options=&quot;chartOptions&quot; :series=&quot;series&quot;&gt;&lt;/apexchart&gt;
  44. &lt;/div&gt;
  45. </div>
  46. <script>
  47. new Vue({
  48. el: '#app',
  49. components: {
  50. apexchart: VueApexCharts,
  51. },
  52. data: {
  53. series: [44, 55, 41, 17, 15],
  54. chartOptions: {
  55. chart: {
  56. width: 380,
  57. type: 'donut',
  58. dropShadow: {
  59. enabled: true,
  60. color: '#111',
  61. top: -1,
  62. left: 3,
  63. blur: 3,
  64. opacity: 0.2
  65. }
  66. },
  67. stroke: {
  68. width: 0,
  69. },
  70. plotOptions: {
  71. pie: {
  72. donut: {
  73. labels: {
  74. show: true,
  75. total: {
  76. showAlways: true,
  77. show: true
  78. }
  79. }
  80. }
  81. }
  82. },
  83. labels: ["Comedy", "Action", "SciFi", "Drama", "Horror"],
  84. dataLabels: {
  85. dropShadow: {
  86. blur: 3,
  87. opacity: 0.8
  88. }
  89. },
  90. fill: {
  91. type: 'pattern',
  92. opacity: 1,
  93. pattern: {
  94. enabled: true,
  95. style: ['verticalLines', 'squares', 'horizontalLines', 'circles','slantedLines'],
  96. },
  97. },
  98. states: {
  99. hover: {
  100. filter: 'none'
  101. }
  102. },
  103. theme: {
  104. palette: 'palette2'
  105. },
  106. title: {
  107. text: "Favourite Movie Type"
  108. },
  109. responsive: [{
  110. breakpoint: 480,
  111. options: {
  112. chart: {
  113. width: 200
  114. },
  115. legend: {
  116. position: 'bottom'
  117. }
  118. }
  119. }]
  120. },
  121. },
  122. })
  123. </script>
  124. </body>
  125. </html>