From 48d2004472e6cdee3c5fe401db10b3c722ee212a Mon Sep 17 00:00:00 2001 From: dengj <209192278@qq.com> Date: Mon, 18 Dec 2023 10:46:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=93=E6=B4=81=20:=20=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/content/airInfo/AirInfo.vue | 27 +++++++++++++++++-- .../content/badGasInfo/BadGasInfo.vue | 22 ++++++++++++--- src/components/content/usedEle/UsedEle.vue | 14 +++++++++- .../content/windPressure/WindPressureList.vue | 13 ++++++++- 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/src/components/content/airInfo/AirInfo.vue b/src/components/content/airInfo/AirInfo.vue index be5161a..5dc94ba 100644 --- a/src/components/content/airInfo/AirInfo.vue +++ b/src/components/content/airInfo/AirInfo.vue @@ -175,9 +175,21 @@ const initChart = () => { tooltip: { show: true, trigger: 'axis', + backgroundColor: "transparent", // 设置背景颜色为透明 + borderColor: "transparent", // 设置边框颜色为透明 + padding: 0, // 设置内边距为0 textStyle: { fontSize: 40 - } + }, + formatter: function (params) { + let content = ` +
+
${params[0].name}
+
进风口: ${params[0].value}
+
出风口: ${params[1].value}
+
`; + return content; + }, }, toolbox: { show: false, @@ -267,9 +279,20 @@ const initAirChart = () => { tooltip: { show: true, trigger: 'axis', + backgroundColor: "transparent", // 设置背景颜色为透明 + borderColor: "transparent", // 设置边框颜色为透明 + padding: 0, // 设置内边距为0 textStyle: { fontSize: 40 - } + }, + formatter: function (params) { + let content = ` +
+
${params[0].name}
+
${params[0].value}
+
`; + return content; + }, }, toolbox: { show: false, diff --git a/src/components/content/badGasInfo/BadGasInfo.vue b/src/components/content/badGasInfo/BadGasInfo.vue index 37dc796..93701cd 100644 --- a/src/components/content/badGasInfo/BadGasInfo.vue +++ b/src/components/content/badGasInfo/BadGasInfo.vue @@ -156,9 +156,25 @@ const initChart = () => { tooltip: { show: true, trigger: "axis", + backgroundColor: "rgba(20,36,51,0.7)", // 设置背景颜色为透明 + borderColor: "#6087BA", // 设置边框颜色为透明 + padding: 0, // 设置内边距为0 + borderWidth:2, textStyle: { - fontSize: 40 - } + fontSize: 40, + }, + formatter: (params)=> { + console.log(params) + let res = `
${params[0].name}
` + '
' + for (let i = 0; i < params.length; i++) { + res += ` +
${params[i].seriesName}: ${params[i].value}
+ `; + } + return res + + // return content; + }, }, toolbox: { show: false, @@ -301,7 +317,7 @@ const initChart = () => { }, ], }; - myEcharts.setOption(option); + myEcharts.setOption(option,true); //图表大小自适应窗口大小变化 window.onresize = () => { myEcharts.resize(); diff --git a/src/components/content/usedEle/UsedEle.vue b/src/components/content/usedEle/UsedEle.vue index b6edf70..26b8f3c 100644 --- a/src/components/content/usedEle/UsedEle.vue +++ b/src/components/content/usedEle/UsedEle.vue @@ -127,9 +127,21 @@ const initChart = () => { tooltip: { show: true, trigger: 'axis', + backgroundColor: "transparent", // 设置背景颜色为透明 + borderColor: "transparent", // 设置边框颜色为透明 + padding: 0, // 设置内边距为0 textStyle: { fontSize: 40 - } + }, + formatter: function (params) { + let content = ` +
+
${params[0].name}日
+
日用电量: ${params[0].value}
+
日节省量: ${params[1].value}
+
`; + return content; + }, }, toolbox: { show: false, diff --git a/src/components/content/windPressure/WindPressureList.vue b/src/components/content/windPressure/WindPressureList.vue index 243d419..639bf88 100644 --- a/src/components/content/windPressure/WindPressureList.vue +++ b/src/components/content/windPressure/WindPressureList.vue @@ -129,9 +129,20 @@ const initChart = (type, values) => { tooltip: { show: true, trigger: 'axis', + backgroundColor: "transparent", // 设置背景颜色为透明 + borderColor: "transparent", // 设置边框颜色为透明 + padding: 0, // 设置内边距为0 textStyle: { fontSize: 40 - } + }, + formatter: function (params) { + let content = ` +
+
${params[0].name}
+
${params[0].value}
+
`; + return content; + }, }, toolbox: { show: false,