From c9edc21dac11a334c1a49aec5cb829760def34c2 Mon Sep 17 00:00:00 2001 From: longyvfengyun <496960745@qq.com> Date: 星期四, 28 三月 2024 13:30:53 +0800 Subject: [PATCH] 内容修改 --- src/util/getChartLinesMax.js | 18 +++++++++ src/views/analysis/lofAnalysis.vue | 16 +++++++ src/views/analysis/fusionAnalysis.vue | 31 ++++++++++++++- src/views/analysis/hdAnalysis.vue | 31 ++++++++++----- src/views/analysis/fhAnalysis.vue | 16 +++++++ 5 files changed, 98 insertions(+), 14 deletions(-) diff --git a/src/util/getChartLinesMax.js b/src/util/getChartLinesMax.js new file mode 100644 index 0000000..a19c804 --- /dev/null +++ b/src/util/getChartLinesMax.js @@ -0,0 +1,18 @@ +export default function getChartLinesMax(data) { + let result = { + x: -1, + y: -Infinity, + z: 0 + }; + + data.map((item,key)=>{ + item.map((item1, key1)=>{ + if(Number(item1)>Number(result.y)) { + result.x = key1; + result.y = item1; + result.z = key; + } + }); + }); + return result; +} diff --git a/src/views/analysis/fhAnalysis.vue b/src/views/analysis/fhAnalysis.vue index 8fb305d..2c0eb49 100644 --- a/src/views/analysis/fhAnalysis.vue +++ b/src/views/analysis/fhAnalysis.vue @@ -7,6 +7,7 @@ import HdwChart from "@/components/echarts/hdwChart.vue"; import getNormalLine from "@/components/echarts/options/normalLine"; import {ElMessage} from "element-plus"; +import getChartLinesMax from "@/util/getChartLinesMax"; const carName = ref(""); const timeRange = ref([]); @@ -173,6 +174,7 @@ title4.value = data.y4Name; let chart4Data = formatData(data.bmsAlgorithmVoList4); chart4Option.xAxis.data = chart4Data.x; + const chart4MaxInfo = getChartLinesMax(chart4Data.y); chart4Option.series = chart4Data.y.map((item, key)=>{ return { name: '#'+(key+1), @@ -180,6 +182,19 @@ sampling: "lttb", smooth: false, symbolSize: 0, + markPoint: { + data: [ + { + name: "鏈�澶у��", + value: "#"+(chart4MaxInfo.x+1), + xAxis: chart4Data.x[chart4MaxInfo.x], + yAxis: chart4MaxInfo.y, + itemStyle: { + color: '#ff0000' + } + }, + ] + }, data: item, } }); @@ -260,7 +275,6 @@ left: '1%', right: '4%', bottom: '3%', - top: "6%", containLabel: true } }); diff --git a/src/views/analysis/fusionAnalysis.vue b/src/views/analysis/fusionAnalysis.vue index b101915..bee1078 100644 --- a/src/views/analysis/fusionAnalysis.vue +++ b/src/views/analysis/fusionAnalysis.vue @@ -7,6 +7,7 @@ import HdwChart from "@/components/echarts/hdwChart.vue"; import getNormalLine from "@/components/echarts/options/normalLine"; import {ElMessage} from "element-plus"; +import getChartLinesMax from "@/util/getChartLinesMax"; const carName = ref(""); const timeRange = ref([]); @@ -146,6 +147,7 @@ title3.value = data.y3Name; let chart3Data = formatData(data.bmsAlgorithmVoList3); chart3Option.xAxis.data = chart3Data.x; + const chart3MaxInfo = getChartLinesMax(chart3Data.y); chart3Option.series = chart3Data.y.map((item, key)=>{ return { name: '#'+(key+1), @@ -154,6 +156,19 @@ smooth: false, symbolSize: 0, data: item, + markPoint: { + data: [ + { + name: "鏈�澶у��", + value: "#"+(chart3MaxInfo.z+1), + xAxis: chart3Data.x[chart3MaxInfo.x], + yAxis: chart3MaxInfo.y, + itemStyle: { + color: '#ff0000' + } + }, + ] + }, } }); chart3Option.series.push({ @@ -173,6 +188,7 @@ title4.value = data.y4Name; let chart4Data = formatData(data.bmsAlgorithmVoList4); chart4Option.xAxis.data = chart4Data.x; + const chart4MaxInfo = getChartLinesMax(chart4Data.y); chart4Option.series = chart4Data.y.map((item, key)=>{ return { name: '#'+(key+1), @@ -180,6 +196,19 @@ sampling: "lttb", smooth: false, symbolSize: 0, + markPoint: { + data: [ + { + name: "鏈�澶у��", + value: "#"+(chart4MaxInfo.z+1), + xAxis: chart4Data.x[chart4MaxInfo.x], + yAxis: chart4MaxInfo.y, + itemStyle: { + color: '#ff0000' + } + }, + ] + }, data: item, } }); @@ -244,7 +273,6 @@ left: '1%', right: '4%', bottom: '3%', - top: "6%", containLabel: true } }); @@ -260,7 +288,6 @@ left: '1%', right: '4%', bottom: '3%', - top: "6%", containLabel: true } }); diff --git a/src/views/analysis/hdAnalysis.vue b/src/views/analysis/hdAnalysis.vue index ee08291..5d8c096 100644 --- a/src/views/analysis/hdAnalysis.vue +++ b/src/views/analysis/hdAnalysis.vue @@ -7,6 +7,7 @@ import HdwChart from "@/components/echarts/hdwChart.vue"; import getNormalLine from "@/components/echarts/options/normalLine"; import {ElMessage} from "element-plus"; +import getChartLinesMax from "@/util/getChartLinesMax"; const carName = ref(""); const timeRange = ref([]); @@ -145,10 +146,13 @@ // 鍥捐〃3 title3.value = data.y3Name; let chart3Data = formatData(data.bmsAlgorithmVoList3); - chart3Option.xAxis.data = chart3Data.x; + chart3Option.xAxis.data = chart3Data.x.map(item=>{ + return '#'+(item+1); + }); + const chart3MaxInfo = getChartLinesMax(chart3Data.y); chart3Option.series = chart3Data.y.map((item, key)=>{ return { - name: '#'+(key+1), + name: data.y3Name, type: 'line', sampling: "lttb", smooth: false, @@ -156,8 +160,10 @@ markPoint: { data: [ { - type: 'max', - name: 'Max', + name: "鏈�澶у��", + value: "#"+(chart3MaxInfo.x+1), + xAxis: chart3Data.x[chart3MaxInfo.x], + yAxis: chart3MaxInfo.y, itemStyle: { color: '#ff0000' } @@ -183,10 +189,13 @@ // 鍥捐〃4 title4.value = data.y4Name; let chart4Data = formatData(data.bmsAlgorithmVoList4); - chart4Option.xAxis.data = chart4Data.x; + chart4Option.xAxis.data = chart4Data.x.map(item=>{ + return '#'+(item+1); + }); + const chart4MaxInfo = getChartLinesMax(chart4Data.y); chart4Option.series = chart4Data.y.map((item, key)=>{ return { - name: '#'+(key+1), + name: data.y4Name, type: 'line', sampling: "lttb", smooth: false, @@ -194,8 +203,10 @@ markPoint: { data: [ { - type: 'max', - name: 'Max', + name: "鏈�澶у��", + value: "#"+(chart4MaxInfo.x+1), + xAxis: chart4Data.x[chart4MaxInfo.x], + yAxis: chart4MaxInfo.y, itemStyle: { color: '#ff0000' } @@ -269,7 +280,7 @@ containLabel: true } }); - chart3Option.tooltip.show = false; + chart3Option.tooltip.show = true; chart3Option.xAxis.axisLabel.show = true; chart3Option.xAxis.axisLine.show = true; @@ -284,7 +295,7 @@ containLabel: true } }); - chart4Option.tooltip.show = false; + chart4Option.tooltip.show = true; chart4Option.xAxis.axisLabel.show = true; chart4Option.xAxis.axisLine.show = true; } diff --git a/src/views/analysis/lofAnalysis.vue b/src/views/analysis/lofAnalysis.vue index 5e0b23a..1d9abc8 100644 --- a/src/views/analysis/lofAnalysis.vue +++ b/src/views/analysis/lofAnalysis.vue @@ -7,6 +7,7 @@ import HdwChart from "@/components/echarts/hdwChart.vue"; import getNormalLine from "@/components/echarts/options/normalLine"; import {ElMessage} from "element-plus"; +import getChartLinesMax from "@/util/getChartLinesMax"; const carName = ref(""); const timeRange = ref([]); @@ -173,6 +174,7 @@ title4.value = data.y4Name; let chart4Data = formatData(data.bmsAlgorithmVoList4); chart4Option.xAxis.data = chart4Data.x; + const chart4MaxInfo = getChartLinesMax(chart4Data.y); chart4Option.series = chart4Data.y.map((item, key)=>{ return { name: '#'+(key+1), @@ -180,6 +182,19 @@ sampling: "lttb", smooth: false, symbolSize: 0, + markPoint: { + data: [ + { + name: "鏈�澶у��", + value: "#"+(chart4MaxInfo.x+1), + xAxis: chart4Data.x[chart4MaxInfo.x], + yAxis: chart4MaxInfo.y, + itemStyle: { + color: '#ff0000' + } + }, + ] + }, data: item, } }); @@ -260,7 +275,6 @@ left: '1%', right: '4%', bottom: '3%', - top: "6%", containLabel: true } }); -- Gitblit v1.9.1