Jelajahi Sumber

feat:修改文字描述

wangsisi 1 hari lalu
induk
melakukan
a238dc8a32

+ 8 - 14
src/views/warningHome/components/chart_components/chartList.vue

@@ -43,7 +43,7 @@
             </chart-box>
         </div>
         <div class="chart-item">
-            <chart-box :name="`平泉街道非农化非粮化占比统计`">
+            <chart-box :name="`平泉街道非农化非粮化面积统计`">
                 <div class="box-content">
                     <div class="chart-dom">
                         <bar-chart
@@ -128,6 +128,9 @@ const yieldChartData = ref({
 // 用地面积统计摘要文字
 const yieldSummaryText = ref("暂无数据");
 
+// y 轴格式化器(不显示百分比)
+const yAxisFormatter = "{value}";
+
 onMounted(() => {
     // 监听图例组件的变化事件
     eventBus.on("landUseLegend:change", handleLandUseLegendChange);
@@ -218,11 +221,7 @@ const fetchYieldChartData = () => {
                 
                 // 转换接口数据为柱状图格式
                 const categories = res.data.map((item) => item.name);
-                const values = res.data.map((item) => {
-                    // 计算百分比
-                    const percent = total > 0 ? ((item.plantArea / total) * 100).toFixed(2) : 0;
-                    return parseFloat(percent);
-                });
+                const values = res.data.map((item) => parseFloat(item.plantArea.toFixed(1)));
 
                 // 更新图表数据
                 yieldChartData.value = {
@@ -247,13 +246,8 @@ const fetchYieldChartData = () => {
                 });
 
                 // 更新摘要文字
-                if (maxName && minName && total > 0) {
-                    const maxPercent = ((maxValue / total) * 100).toFixed(1);
-                    const minPercent = ((minValue / total) * 100).toFixed(1);
-                    yieldSummaryText.value = `${maxName}的种植面积最大,占比${maxPercent}%;${minName}的种植面积最小,占比${minPercent}%`;
-                } else if (maxName && total > 0) {
-                    const maxPercent = ((maxValue / total) * 100).toFixed(1);
-                    yieldSummaryText.value = `${maxName}的种植面积最大,占比${maxPercent}%`;
+                if (maxName) {
+                    yieldSummaryText.value = `当前${maxName}的面积占有${maxValue.toFixed(1)}亩`;
                 } else {
                     yieldSummaryText.value = "暂无数据";
                 }
@@ -310,7 +304,7 @@ const fetchStatPhenologyAreaRatioForGrain = () => {
                 // 更新摘要文字
                 if (maxPhenology) {
                     const maxPercent = (maxRatio * 100).toFixed(1);
-                    regionSummaryText.value = `${maxPhenology}的种植面积最大,占比${maxPercent}%,进入${maxPhenologyName}`;
+                    regionSummaryText.value = `当前有${maxPercent}%的${maxPhenology}进入${maxPhenologyName}`;
                 } else {
                     regionSummaryText.value = "暂无数据";
                 }