From 664a46fc62954c7ee167177e373b81b458e8f91c Mon Sep 17 00:00:00 2001
From: zhujiyan <17812234322@163.com>
Date: Thu, 4 Jul 2024 14:22:13 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B9=E6=A1=88=E6=95=B0=E6=8D=AE=E8=B6=8B?=
=?UTF-8?q?=E5=8A=BF=E5=9B=BE=E5=A4=9Ay=E8=BD=B4=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/govern/device/planData/index.vue | 152 +++++++++++++++++----
1 file changed, 125 insertions(+), 27 deletions(-)
diff --git a/src/views/govern/device/planData/index.vue b/src/views/govern/device/planData/index.vue
index a9a78ce..39520e6 100644
--- a/src/views/govern/device/planData/index.vue
+++ b/src/views/govern/device/planData/index.vue
@@ -165,6 +165,7 @@ import { useDictData } from '@/stores/dictData'
import { queryStatistical } from '@/api/system-boot/csstatisticalset'
import * as echarts from 'echarts'
import { isNonNullChain } from 'typescript'
+import { position } from 'html2canvas/dist/types/css/property-descriptors/position'
const dictData = useDictData()
defineOptions({
name: 'govern/device/manage'
@@ -280,6 +281,21 @@ const init = async () => {
})
})
+ //颜色数组
+ const colorList = [
+ '#DAA521',
+ '#2E8B58',
+ 'blueviolet',
+ '#A5292A',
+ 'aqua',
+ '#d81e06',
+ 'coral',
+ '#012B6A',
+ 'brown',
+ '#70B601',
+ '#1DD0CE',
+ 'cadetblue',
+ ]
if (historyDevId.value) {
//选择的指标使用方法处理
initSearchFormIndexAndCount(searchForm.value.index)
@@ -339,10 +355,12 @@ const init = async () => {
let xAxis: any = [],
timeList: any = []
- let unit = ''
+ let unitList: any = []
historyDataList.value.map((item: any) => {
timeList.push(item.time)
- unit = item.unit
+ if (unitList.indexOf(item.unit) == -1) {
+ unitList.push(item.unit)
+ }
})
xAxis = timeList.sort((a: any, b: any) => {
return (
@@ -361,7 +379,8 @@ const init = async () => {
options: {
title: [
{
- left: 'center',
+ left: '10%',
+ top: 0,
text: chartTitle.value
}
],
@@ -378,6 +397,21 @@ const init = async () => {
trigger: 'axis',
axisPointer: {
type: 'shadow'
+ },
+ formatter: function (params: any) {
+ var res = params[0].name + '
'
+ for (var i = 0, l = params.length; i < l; i++) {
+ params[i].unit =
+ echartsData.value.options.yAxis[
+ echartsData.value.options.series[params[i].seriesIndex].yAxisIndex
+ ]?.name
+ res +=
+ params[i].seriesName +
+ ' ' +
+ `