ChartRound.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <script setup lang="ts">
  2. import { ref, computed } from "vue";
  3. import { useDark, useECharts } from "@pureadmin/utils";
  4. const { isDark } = useDark();
  5. const theme = computed(() => (isDark.value ? "dark" : "light"));
  6. const chartRef = ref();
  7. const { setOptions } = useECharts(chartRef, {
  8. theme,
  9. renderer: "svg"
  10. });
  11. setOptions({
  12. container: ".line-card",
  13. title: {
  14. text: "100%",
  15. left: "47%",
  16. top: "30%",
  17. textAlign: "center",
  18. textStyle: {
  19. fontSize: "16",
  20. fontWeight: 600
  21. }
  22. },
  23. polar: {
  24. radius: ["100%", "90%"],
  25. center: ["50%", "50%"]
  26. },
  27. angleAxis: {
  28. max: 100,
  29. show: false
  30. },
  31. radiusAxis: {
  32. type: "category",
  33. show: true,
  34. axisLabel: {
  35. show: false
  36. },
  37. axisLine: {
  38. show: false
  39. },
  40. axisTick: {
  41. show: false
  42. }
  43. },
  44. series: [
  45. {
  46. type: "bar",
  47. roundCap: true,
  48. barWidth: 2,
  49. showBackground: true,
  50. backgroundStyle: {
  51. color: "#dfe7ef"
  52. },
  53. data: [100],
  54. coordinateSystem: "polar",
  55. color: "#7846e5",
  56. itemStyle: {
  57. shadowBlur: 2,
  58. shadowColor: "#7846e5",
  59. shadowOffsetX: 0,
  60. shadowOffsetY: 0
  61. }
  62. }
  63. ]
  64. });
  65. </script>
  66. <template>
  67. <div ref="chartRef" style="width: 100%; height: 60px" />
  68. </template>