From 31ea18fbc42cca3b61c2d02827ef52f03625d251 Mon Sep 17 00:00:00 2001 From: duxiaoning <17621883433@163.com> Date: Mon, 9 Oct 2023 13:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=AF=E5=B7=AE=E5=9B=BE?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E9=9D=A2=E5=8C=85=E5=B1=91=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/api/lang/pendingOrder.js | 1 - src/components/rtReport/index.vue | 174 +++++++++++++++++++++++--- src/lib/cesiumUtils.js | 1 + src/lib/request.js | 1 - src/main.js | 3 +- src/views/About.vue | 4 +- src/views/Daichuli/Feedback/index.vue | 15 ++- vue.config.js | 4 +- 9 files changed, 175 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index c1ffc1d..db6626d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "cesium": "1.68", "cesium-navigation-es6": "^1.0.9", "core-js": "^3.6.5", - "echarts": "^4.9.0", + "echarts": "5.4.1", "echarts-stat": "^1.2.0", "element-ui": "^2.15.5", "jquery": "^3.5.1", diff --git a/src/api/lang/pendingOrder.js b/src/api/lang/pendingOrder.js index bbeafd9..1ff0b9e 100644 --- a/src/api/lang/pendingOrder.js +++ b/src/api/lang/pendingOrder.js @@ -200,7 +200,6 @@ export async function getUserInfo(token) { return request({ url: "/app/logincheck?token=" + token, method: "get", - // baseURL: "http://124.16.188.131:18030/yunguan-app" baseURL: process.env.VUE_APP_BASE_API+"/yunguan-app" }); } diff --git a/src/components/rtReport/index.vue b/src/components/rtReport/index.vue index 07193cd..08ffbf9 100644 --- a/src/components/rtReport/index.vue +++ b/src/components/rtReport/index.vue @@ -121,6 +121,16 @@ 选取点 + @@ -166,6 +176,8 @@ export default { tData: {}, tDatas: null, midValue: 10, + erExpression: null, + erR2: "0.037207", }; }, created() { @@ -316,25 +328,113 @@ export default { xArr.push(errorVala[i].cre_imageValue); data.push(a); } - const x_limit = Math.abs(Math.max(...xArr) / xArr.length); + // const x_limit = Math.abs(Math.max(...xArr) / xArr.length); //多项式回归 - // var myRegression = this.$ecstat.regression("polynomial", data, 3); - let myRegression = this.$ecstat.regression("linear", data); - - myRegression.points.sort(function (a, b) { - return a[0] - b[0]; - }); + let myRegression = this.echartRegression("polynomial", data, 1); var option = { + title: { + text: this.pdSubTypeName + "误差结果图", + left: "center", + top: 16, + }, animation: false, + grid: { + right: "15%", + bottom: "25%", + }, + toolbox: { + show: true, + orient: "vertical", + top: 10, + feature: { + dataZoom: { + title: { + zoom: "区域缩放", + back: "缩放还原", + }, + yAxisIndex: "none", + }, + myTool1: { + show: true, + title: "多项式回归1次", + icon: "path://M272.5,285.5h332m-171-137v296m89-224c-85.7,61.79-199.22,144.16-199,144", + onclick: () => { + myRegression = this.echartRegression("polynomial", data, 1); + option.series[1].data = myRegression.points; + this.myCharts.setOption(option); + }, + }, + myTool2: { + show: true, + title: "多项式回归2次", + icon: "path://M272.5,285.5h332m-171-137v296M338,219.21c5,112.41,55.28,190.63,93,192.37,38.46,1.77,90.59-74.67,91.71-192.82", + onclick: () => { + myRegression = this.echartRegression("polynomial", data, 2); + option.series[1].data = myRegression.points; + this.myCharts.setOption(option); + }, + }, + myTool3: { + show: true, + title: "多项式回归3次", + icon: "path://M272.5,285.5h332m-171-137v296M590,227c-24.25,54.05-59.27,114.65-98.35,113.21-51.58-1.9-71.15-110.45-119.35-110.68-21.39-.1-51.7,21.12-88.8,120", + onclick: () => { + myRegression = this.echartRegression("polynomial", data, 3); + option.series[1].data = myRegression.points; + this.myCharts.setOption(option); + }, + }, + restore: { + title: "还原", + icon: "path://M2.5 2v6h6M2.66 15.57a10 10 0 1 0 .57-8.38", + }, + saveAsImage: { + title: "保存为图片", + }, + }, + }, + dataZoom: [ + { + type: "slider", + xAxisIndex: 0, + filterMode: "none", + }, + { + type: "slider", + yAxisIndex: 0, + filterMode: "none", + right: "60", + }, + ], + legend: { + top: 20, + right: 45, + // selectedMode: false, + data: [ + { + name: "erExpression", + icon: "circle", + }, + // { + // name: "r2", + // icon: "circle", + // }, + ], + formatter: (name) => { + if (name === "erExpression") return this.erExpression; + else if (name === "r2") return this.erR2; + }, + }, xAxis: { name: "像元值(" + this.getProductDes() + ")", nameLocation: "middle", - min: (Math.min(...xArr) - x_limit).toFixed(5), - max: (Math.max(...xArr) + x_limit).toFixed(5), + // min: Number((Math.min(...xArr) - x_limit).toFixed(5)), + // max: Number((Math.max(...xArr) + x_limit).toFixed(5)), nameTextStyle: { lineHeight: 30, height: 60, - fontWeight: "bold", + // fontWeight: "bold", + fontSize: 13, }, }, yAxis: { @@ -342,28 +442,34 @@ export default { nameTextStyle: { lineHeight: 30, height: 60, - fontWeight: "bold", + // fontWeight: "bold", + fontSize: 13, + padding: [0, 0, 10, 0], }, + nameRotate: 90, // 因为是在rightMiddle 所以需要其翻转 将其改为负值 + nameLocation: "center", // y轴name处于y轴的什么位置 }, series: [ { + name: "r2", symbolSize: 10, type: "scatter", data: data, }, { + name: "erExpression", type: "line", smooth: true, showSymbol: false, data: myRegression.points, - itemStyle: { - normal: { - color: "#91cc75", - lineStyle: { - width: 3, - }, - }, - }, + // itemStyle: { + // normal: { + // color: "#91cc75", + // lineStyle: { + // width: 3, + // }, + // }, + // }, }, ], }; @@ -442,6 +548,15 @@ export default { }; option && this.myCharts.setOption(option); }, + echartRegression(regressionType, data, order) { + //regressionType:回归类型'linear', 'exponential', 'logarithmic', 'polynomial';order:多项式的阶数(number)。对于非多项式回归,可以忽略该参数。 + let myRegression = this.$ecstat.regression(regressionType, data, order); + myRegression.points.sort(function (a, b) { + return a[0] - b[0]; + }); + this.erExpression = myRegression.expression; + return myRegression; + }, }, }; @@ -539,4 +654,25 @@ export default { } } } +.erTip { + position: absolute; + top: 10px; + right: 26px; + font-size: small; + text-align: end; + .echartReg { + height: 20px; + line-height: 20px; + margin: 0 5px; + .echartRegName { + display: inline-block; + width: 9px; + height: 9px; + background-color: #7a96c6; + // border: 1px solid #7A96C6; + border-radius: 50%; + margin-right: 5px; + } + } +} diff --git a/src/lib/cesiumUtils.js b/src/lib/cesiumUtils.js index 2e9f2c8..13b19f1 100644 --- a/src/lib/cesiumUtils.js +++ b/src/lib/cesiumUtils.js @@ -18,6 +18,7 @@ class CesiumUtils { geocoder: false, //地名查找,默认true timeline: false, //时间线,默认true navigationHelpButton: false, //导航帮助说明,默认true + // sceneMode:Cesium.SceneMode.SCENE2D, sceneModePicker: false, //是否显示投影方式控件 infoBox: false, //点击要素之后显示的信息,默认true fullscreenButton: false, //全屏按钮,默认显示true diff --git a/src/lib/request.js b/src/lib/request.js index d912ff3..bdb1862 100644 --- a/src/lib/request.js +++ b/src/lib/request.js @@ -4,7 +4,6 @@ import { Message } from "element-ui"; // create an axios instance const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url - // baseURL: 'http://124.16.188.131:18030/', // url = base url + request url timeout: 5000000 // request timeout }); diff --git a/src/main.js b/src/main.js index 0763848..5939871 100644 --- a/src/main.js +++ b/src/main.js @@ -22,7 +22,8 @@ Vue.prototype.bus=new Vue(); // 加入moment所有的组件 Vue.prototype.$moment = moment; // echarts -import echarts from 'echarts' //引入echarts +// import echarts from 'echarts' //引入echarts +import * as echarts from 'echarts'; import ecstat from 'echarts-stat'/*echarts统计组件*/ Vue.prototype.$ecstat = ecstat /*echarts统计组件*/ Vue.prototype.$echarts = echarts; //引入组件 diff --git a/src/views/About.vue b/src/views/About.vue index 661c7ee..2ba9474 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -151,9 +151,9 @@ export default { let that = this; // 由于本项目大部分属于‘一级’页面,所以在设置路由时候,一级页面不设置breadNumber = 1,‘二级’页面以上才设置breadNumber let breadNumber = - typeof this.$route.meta.breadNumber !== "undefined" + (typeof this.$route.meta.breadNumber !== "undefined" ? this.$route.meta.breadNumber - : 1; + : 1) - 1; // 获取当前页面的名字和路由,并组合成新的对象 let newBread = { name: this.$route.name, path: this.$route.fullPath }; let vuexBreadList = []; // 默认初始化面包屑数据 diff --git a/src/views/Daichuli/Feedback/index.vue b/src/views/Daichuli/Feedback/index.vue index 4470a2a..3987842 100644 --- a/src/views/Daichuli/Feedback/index.vue +++ b/src/views/Daichuli/Feedback/index.vue @@ -112,6 +112,7 @@