gradient-donut.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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>Gradient Donut</title>
  8. <link href="../../assets/styles.css" rel="stylesheet" />
  9. <style>
  10. #chart {
  11. max-width: 380px;
  12. margin: 35px auto;
  13. padding: 0;
  14. }
  15. .apexcharts-legend-text tspan:nth-child(1) {
  16. font-weight: lighter;
  17. fill: #999;
  18. }
  19. .apexcharts-legend-text tspan:nth-child(3) {
  20. font-weight: bold;
  21. }
  22. </style>
  23. <script>
  24. window.Promise ||
  25. document.write(
  26. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  27. )
  28. window.Promise ||
  29. document.write(
  30. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  31. )
  32. window.Promise ||
  33. document.write(
  34. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  35. )
  36. </script>
  37. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  38. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  39. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  40. </head>
  41. <body>
  42. <div id="app">
  43. <div id="chart">
  44. <apexchart type="donut" width="380" :options="chartOptions" :series="series"></apexchart>
  45. </div>
  46. </div>
  47. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  48. <div id="html">
  49. &lt;div id=&quot;chart&quot;&gt;
  50. &lt;apexchart type=&quot;donut&quot; width=&quot;380&quot; :options=&quot;chartOptions&quot; :series=&quot;series&quot;&gt;&lt;/apexchart&gt;
  51. &lt;/div&gt;
  52. </div>
  53. <script>
  54. new Vue({
  55. el: '#app',
  56. components: {
  57. apexchart: VueApexCharts,
  58. },
  59. data: {
  60. series: [44, 55, 41, 17, 15],
  61. chartOptions: {
  62. chart: {
  63. width: 380,
  64. type: 'donut',
  65. },
  66. dataLabels: {
  67. enabled: false
  68. },
  69. fill: {
  70. type: 'gradient',
  71. },
  72. legend: {
  73. formatter: function(val, opts) {
  74. return val + " - " + opts.w.globals.series[opts.seriesIndex]
  75. }
  76. },
  77. responsive: [{
  78. breakpoint: 480,
  79. options: {
  80. chart: {
  81. width: 200
  82. },
  83. legend: {
  84. position: 'bottom'
  85. }
  86. }
  87. }]
  88. },
  89. },
  90. })
  91. </script>
  92. </body>
  93. </html>