瀏覽代碼

build: 评分占比柱状图调整

chaooo 2 年之前
父節點
當前提交
79bbfc1397
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      src/components/Charts/PercentBarChart.vue

+ 8 - 2
src/components/Charts/PercentBarChart.vue

@@ -43,7 +43,8 @@ const props = defineProps({
 const labelFormatter = (params: any) => {
 const labelFormatter = (params: any) => {
   // 显示人数 加 百分比
   // 显示人数 加 百分比
   if (params.value > 0) {
   if (params.value > 0) {
-    return props.data?.[params.dataIndex] + "人 (" + params.value + "%)";
+    //return props.data?.[params.dataIndex] + "人 (" + params.value + "%)";
+		return `{a|${props.data?.[params.dataIndex]}人 (${params.value}%)}`;
   } else {
   } else {
     return "";
     return "";
   }
   }
@@ -104,8 +105,13 @@ const options = {
       type: "bar",
       type: "bar",
       label: {
       label: {
         show: true,
         show: true,
-        position: "right",
+        position: "insideLeft",
         formatter: labelFormatter,
         formatter: labelFormatter,
+				rich: {
+					a: {
+						padding: [0, 0, 0, 120]
+					},
+				},
       },
       },
       showBackground: true,
       showBackground: true,
       backgroundStyle: {
       backgroundStyle: {