Ver Fonte

词表对齐问题,分析结果图表展示bug

qinpeng há 2 anos atrás
pai
commit
b9cf3a40df
2 ficheiros alterados com 41 adições e 10 exclusões
  1. 4 1
      src/views/Textanalysis/WordTable.vue
  2. 37 9
      src/views/Textanalysis/index.vue

+ 4 - 1
src/views/Textanalysis/WordTable.vue

@@ -95,7 +95,7 @@
           </tr>
           <tr v-for="(item, index) in dataList.list" :key="index + 'td'">
             <td class="sort-td">{{ item.number }}</td>
-            <td :class="['sort-td', typeIndex == 0 ? 'pinyin' : '']">
+            <td :class="['sort-td', typeIndex == 0 ? 'pinyin' : 'hanzi']">
               <span
                 :style="{
                   fontFamily: typeIndex != 0 ? '楷体' : '',
@@ -702,6 +702,9 @@ export default {
         .pinyin {
           font-family: "GB-PINYINOK-B";
         }
+        .hanzi{
+          text-align: left !important;
+        }
         th {
           background: #ffffff;
           .bz {

+ 37 - 9
src/views/Textanalysis/index.vue

@@ -128,14 +128,17 @@
             </div>
           </div>
           <div class="tubiao" id="echarts">
-            <el-switch
-              v-model="ratioShow"
-              inactive-text="比例"
-              :width="26"
-              style="margin-left: 24px"
-              @change="changeratioShow"
-            >
-            </el-switch>
+            <template v-if="chartIndex != 3">
+              <el-switch
+                v-model="ratioShow"
+                inactive-text="比例"
+                :width="26"
+                style="margin-left: 24px"
+                @change="changeratioShow"
+              >
+              </el-switch>
+            </template>
+
             <div id="main_echarts" class="main_echarts"></div>
             <div class="cut_download">
               <span
@@ -953,6 +956,13 @@ export default {
               axisPointer: {
                 type: "shadow",
               },
+              formatter: function (params) {
+                if (that.ratioShow) {
+                  return `${params[0].name}    ${params[0].value}%`;
+                } else {
+                  return `${params[0].name}    ${params[0].value}`;
+                }
+              },
             },
             xAxis: {
               type: "category",
@@ -999,6 +1009,13 @@ export default {
           option = {
             tooltip: {
               trigger: "axis",
+              formatter: function (params) {
+                if (that.ratioShow) {
+                  return `${params[0].name}    ${params[0].value}%`;
+                } else {
+                  return `${params[0].name}    ${params[0].value}`;
+                }
+              },
             },
             xAxis: {
               type: "category",
@@ -1064,7 +1081,18 @@ export default {
                   show: index === 0 ? false : true,
                   formatter: function () {
                     that.leiDaDataIndex = index - 1;
-                    return leidaList[index - 1].name + ":" + value[index - 1];
+                    if (that.ratioShow) {
+                      return (
+                        leidaList[index - 1].name +
+                        ":" +
+                        value[index - 1] +
+                        "%"
+                      );
+                    } else {
+                      return (
+                        leidaList[index - 1].name + ":" + value[index - 1]
+                      );
+                    }
                   },
                 },
                 z: index === 0 ? 1 : 2,