index.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div class="card content-box">
  3. <ECharts :option="option" />
  4. </div>
  5. </template>
  6. <script setup lang="ts" name="pieChart">
  7. import { ECOption } from "@/components/ECharts/config";
  8. import ECharts from "@/components/ECharts/index.vue";
  9. const option: ECOption = {
  10. tooltip: {
  11. trigger: "item",
  12. formatter: "{a} <br/>{b} : {c} ({d}%)"
  13. },
  14. legend: {
  15. left: "center",
  16. top: "bottom",
  17. data: ["rose 1", "rose 2", "rose 3", "rose 4", "rose 5", "rose 6", "rose 7", "rose 8"],
  18. textStyle: {
  19. color: "#a1a1a1"
  20. }
  21. },
  22. toolbox: {
  23. show: true,
  24. feature: {
  25. mark: { show: true },
  26. dataView: { show: true, readOnly: false },
  27. restore: { show: true },
  28. saveAsImage: { show: true }
  29. }
  30. },
  31. series: [
  32. {
  33. name: "Radius Mode",
  34. type: "pie",
  35. radius: [60, 280],
  36. center: ["50%", "50%"],
  37. roseType: "radius",
  38. itemStyle: {
  39. borderRadius: 5
  40. },
  41. label: {
  42. show: true
  43. },
  44. emphasis: {
  45. label: {
  46. show: true
  47. }
  48. },
  49. data: [
  50. { value: 40, name: "rose 1" },
  51. { value: 33, name: "rose 2" },
  52. { value: 28, name: "rose 3" },
  53. { value: 22, name: "rose 4" },
  54. { value: 20, name: "rose 5" },
  55. { value: 15, name: "rose 6" },
  56. { value: 12, name: "rose 7" },
  57. { value: 10, name: "rose 8" }
  58. ]
  59. }
  60. ]
  61. };
  62. </script>
  63. <style scoped lang="scss">
  64. @use "./index" as *;
  65. </style>