Răsfoiți Sursa

堆叠图优化

qianming 6 luni în urmă
părinte
comite
0a82f89deb

+ 7 - 7
report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue

@@ -8,7 +8,7 @@
 import {targetWidgetLinkageLogic} from "@/views/bigscreenDesigner/designer/linkageLogic";
 
 export default {
-  name: "WidgetBarStackchart",
+  name: "WidgetBarStackChart",
   components: {},
   props: {
     value: Object,
@@ -319,7 +319,7 @@ export default {
       const series = this.options.series;
       const legendName = optionsSetup.legendName;
       // 图例没有手动写则显示原值,写了则显示新值
-      if (null == legendName || legendName == "") {
+      if (null == legendName || legendName === "") {
         for (let i = 0; i < name.length; i++) {
           series[i].name = name[i];
         }
@@ -354,7 +354,7 @@ export default {
         });
       }
       // 联动接收者逻辑结束
-      optionsData.dataType == "staticData"
+      optionsData.dataType === "staticData"
         ? this.staticDataFn(optionsData.staticData, optionsSetup)
         : this.dynamicDataFn(
           optionsData.dynamicData,
@@ -374,7 +374,7 @@ export default {
     getStackStyle() {
       const optionsSetup = this.optionsSetup;
       let style = "";
-      if (optionsSetup.stackStyle == "upDown") {
+      if (optionsSetup.stackStyle === "upDown") {
         style = "total";
       }
       return style;
@@ -403,8 +403,8 @@ export default {
         const data = new Array(xAxisList.length).fill(0);
         for (const j in xAxisList) {
           for (const k in val) {
-            if (val[k].name == yAxisList[i]) {
-              if (val[k].axis == xAxisList[j]) {
+            if (val[k].name === yAxisList[i]) {
+              if (val[k].axis === xAxisList[j]) {
                 data[j] = val[k].data;
               }
             }
@@ -522,7 +522,7 @@ export default {
       const series = [];
       const legendName = [];
       for (const i in val.series) {
-        if (val.series[i].type == "bar") {
+        if (val.series[i].type === "bar") {
           series.push({
             name: val.series[i].name,
             type: "bar",

+ 12 - 7
report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue

@@ -1,6 +1,6 @@
 <template>
   <div :style="styleObj">
-    <v-chart ref="myVChart" :option="options" autoresize/>
+    <v-chart  v-if="vChartVisible" ref="myVChart" :option="options" autoresize/>
   </div>
 </template>
 
@@ -8,7 +8,7 @@
 import {targetWidgetLinkageLogic} from "@/views/bigscreenDesigner/designer/linkageLogic";
 
 export default {
-  name: "WidgetBarStackchart",
+  name: "WidgetLineStackChart",
   components: {},
   props: {
     value: Object,
@@ -16,6 +16,7 @@ export default {
   },
   data() {
     return {
+      vChartVisible: true,
       options: {
         grid: {},
         legend: {
@@ -336,7 +337,7 @@ export default {
       const series = this.options.series;
       const legendName = optionsSetup.legendName;
       // 图例没有手动写则显示原值,写了则显示新值
-      if (null == legendName || legendName == "") {
+      if (null == legendName || legendName === "") {
         for (let i = 0; i < name.length; i++) {
           series[i].name = name[i];
         }
@@ -383,7 +384,7 @@ export default {
         });
       }
       // 联动接收者逻辑结束
-      optionsData.dataType == "staticData"
+      optionsData.dataType === "staticData"
         ? this.staticDataFn(optionsData.staticData, optionsSetup)
         : this.dynamicDataFn(
           optionsData.dynamicData,
@@ -423,8 +424,8 @@ export default {
         const data = new Array(xAxisList.length).fill(0);
         for (const j in xAxisList) {
           for (const k in val) {
-            if (val[k].name == yAxisList[i]) {
-              if (val[k].axis == xAxisList[j]) {
+            if (val[k].name === yAxisList[i]) {
+              if (val[k].axis === xAxisList[j]) {
                 data[j] = val[k].data;
               }
             }
@@ -548,7 +549,7 @@ export default {
       const series = [];
       const legendName = [];
       for (const i in val.series) {
-        if (val.series[i].type == "line") {
+        if (val.series[i].type === "line") {
           series.push({
             name: val.series[i].name,
             type: "line",
@@ -618,6 +619,10 @@ export default {
       this.options.series = series;
       this.options.legend["data"] = legendName;
       this.setOptionsLegendName(legendName);
+      this.vChartVisible = false
+      this.$nextTick(() => {
+        this.vChartVisible = true
+      })
     },
   },
 };