Selaa lähdekoodia

修改下载问题

chenbaoxin 4 kuukautta sitten
vanhempi
commit
f7a8e200cc

+ 11 - 6
src/components/LineChart/index.vue

@@ -101,6 +101,7 @@ const initChart = () => {
         // color: item.color || "#00FF00", // Default color
       },
       data: item.data,
+      animation: false
     })),
   };
   myChart.setOption(option,true);
@@ -118,21 +119,25 @@ const saveChartAndSend = async () => {
   tempChart.setOption(option);
 
   // 设置导出时坐标轴样式为黑色
-  tempChart.setOption({
-    xAxis: {
+ tempChart.setOption({
+    xAxis: option.xAxis.map((xAxis: any) => ({
+      ...xAxis,
       axisLine: { lineStyle: { color: "#000000" } },
       axisLabel: { color: "#000000" }
-    },
-    yAxis: {
+    })),
+    yAxis: option.yAxis.map((yAxis: any) => ({
+      ...yAxis,
       axisLine: { lineStyle: { color: "#000000" } },
       axisLabel: { color: "#000000" }
-    }
+    })),
+        series: option.series
   });
+console.log(tempChart.getOption());
 
   // 导出图表
   const imgData = await tempChart.getDataURL({
     type: 'png',
-    pixelRatio: 1,
+    pixelRatio: 2,
     backgroundColor: '#fff'
   });
 

+ 2 - 2
src/views/OperationalReliabilityPrediction/index.vue

@@ -155,11 +155,11 @@ let serviceDataRef=ref(null)
 const getAllDomElements = async () => {
   // this.$nextTick(() => {
    let imgBase64= await lineChartRef.value.saveChartAndSend();
-   console.log(imgBase64.split(';')[1]);
+   console.log(imgBase64);
    
     serviceDataRef.value={
     ...serviceDataRef.value,
-    image:imgBase64.split(';')[1]
+    image:imgBase64.split(',')[1]
    }
      downloadFile(downloadStrategy(), "预测结果.docx", { ...serviceDataRef.value });