提交更改
This commit is contained in:
@@ -421,7 +421,6 @@ const init = (flag: boolean) => {
|
||||
dataLevel: searchForm.value.dataLevel,
|
||||
valueType: searchForm.value.type
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
loading.value = true
|
||||
getHistoryTrend(obj)
|
||||
@@ -429,27 +428,14 @@ const init = (flag: boolean) => {
|
||||
if (res.code === 'A0000') {
|
||||
historyDataList.value = res.data
|
||||
let chartsList = JSON.parse(JSON.stringify(res.data))
|
||||
echartsData.value = null
|
||||
echartsData.value = {}
|
||||
//icon图标替换legend图例
|
||||
const iconThree =
|
||||
'path://M512 85.333333c235.637333 0 426.666667 191.029333 426.666667 426.666667S747.637333 938.666667 512 938.666667 85.333333 747.637333 85.333333 512 276.362667 85.333333 512 85.333333z m214.592 318.677334a32 32 0 0 0-45.248 0.064L544.736 541.066667l-81.792-89.109334a32 32 0 0 0-46.613333-0.576l-119.36 123.733334a32 32 0 1 0 46.058666 44.437333l95.754667-99.264 81.418667 88.704a32 32 0 0 0 46.24 0.96l160.213333-160.693333a32 32 0 0 0-0.064-45.248z'
|
||||
// let xAxis: any = [] //x轴数据数组
|
||||
// let timeList: any = [] //x轴数据数组
|
||||
// y轴单位数组
|
||||
let unitList: any = []
|
||||
let allUnitArray: any = []
|
||||
chartsList.map((item: any) => {
|
||||
// timeList.push(item.time)
|
||||
// if (unitList.indexOf(item.unit) == -1) {
|
||||
// unitList.push(item.unit)
|
||||
// }
|
||||
allUnitArray.push({ name: item.anotherName, unit: item.unit })
|
||||
})
|
||||
// xAxis = new Set(
|
||||
// timeList.sort((a: any, b: any) => {
|
||||
// return new Date(a).getTime() - new Date(b).getTime()
|
||||
// })
|
||||
// )
|
||||
//去除重复的unit单位数据
|
||||
unitList = allUnitArray.reduce((result: any, obj: any) => {
|
||||
if (!result.some((item: any) => JSON.stringify(item) === JSON.stringify(obj))) {
|
||||
@@ -594,7 +580,8 @@ const init = (flag: boolean) => {
|
||||
}
|
||||
},
|
||||
splitNumber: 5,
|
||||
minInterval: 1
|
||||
minInterval: 1,
|
||||
yAxisIndex: 0
|
||||
}
|
||||
],
|
||||
series: []
|
||||
@@ -602,55 +589,6 @@ const init = (flag: boolean) => {
|
||||
}
|
||||
|
||||
echartsData.value.options.legend.data = []
|
||||
|
||||
list.map((item: any, index: any) => {
|
||||
item.map((vv: any, indexs: any) => {
|
||||
//处理legend
|
||||
if (chartsList.length != 0) {
|
||||
echartsData.value.options.legend.data.push({
|
||||
name: vv.phase + '相' + vv.showName
|
||||
// icon: iconThree
|
||||
})
|
||||
}
|
||||
if (
|
||||
unitList.findIndex((item: any) => {
|
||||
return item.unit == vv.unit && item.name == vv.showName
|
||||
}) != -1
|
||||
) {
|
||||
vv.yAxisIndex = unitList.findIndex((item: any) => {
|
||||
return item.unit == vv.unit && item.name == vv.showName
|
||||
})
|
||||
} else {
|
||||
vv.yAxisIndex = 0
|
||||
}
|
||||
echartsData.value.options.series.push({
|
||||
name: vv.phase + '相' + vv.showName,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
itemStyle: {},
|
||||
//数据
|
||||
data: filterArray(
|
||||
chartsList
|
||||
.map((kk: any, kks: any) => {
|
||||
if (kk.statisticalName == vv.name) {
|
||||
// xAxis[kks]
|
||||
return [kk.time, kk.statisticalData]
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
.filter((kk: any) => kk !== '')
|
||||
),
|
||||
//数据对应的y轴
|
||||
// yAxisIndex:0,
|
||||
yAxisIndex: vv.yAxisIndex
|
||||
})
|
||||
})
|
||||
})
|
||||
//处理多y轴
|
||||
// if (unitList.length != 0 && unitList.length > 1) {
|
||||
// console.log(max, min)
|
||||
@@ -694,6 +632,56 @@ const init = (flag: boolean) => {
|
||||
}
|
||||
})
|
||||
// }
|
||||
list.map((item: any, index: any) => {
|
||||
console.log(item, '++++++++++++596')
|
||||
item.map((vv: any, indexs: any) => {
|
||||
//处理legend
|
||||
if (chartsList.length != 0) {
|
||||
echartsData.value.options.legend.data.push({
|
||||
name: vv.phase + '相' + vv.showName
|
||||
})
|
||||
}
|
||||
if (
|
||||
unitList.findIndex((item: any) => {
|
||||
return item.unit == vv.unit && item.name == vv.showName
|
||||
}) != -1
|
||||
) {
|
||||
vv.yAxisIndex = unitList.findIndex((item: any) => {
|
||||
return item.unit == vv.unit && item.name == vv.showName
|
||||
})
|
||||
} else {
|
||||
vv.yAxisIndex = 0
|
||||
}
|
||||
console.log(vv, '<================>', vv.unit)
|
||||
echartsData.value.options.series.push({
|
||||
name: vv.phase + '相' + vv.showName,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
itemStyle: {},
|
||||
//数据
|
||||
data: filterArray(
|
||||
chartsList
|
||||
.map((kk: any, kks: any) => {
|
||||
if (kk.statisticalName == vv.name) {
|
||||
// xAxis[kks]
|
||||
return [kk.time, kk.statisticalData]
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
.filter((kk: any) => kk !== '')
|
||||
),
|
||||
//数据对应的y轴
|
||||
yAxisIndex: vv.yAxisIndex
|
||||
})
|
||||
})
|
||||
})
|
||||
console.log(list, '6444和那个的哈哈哈哈呀哈哈哈哈哈哈哈哈哈哈哈')
|
||||
|
||||
//设置数据项颜色
|
||||
echartsData.value.options.series.map((item: any, index: any) => {
|
||||
item.itemStyle = {
|
||||
@@ -706,6 +694,10 @@ const init = (flag: boolean) => {
|
||||
}
|
||||
// item.data = filterArray(item.data)
|
||||
})
|
||||
// echartsData.value.options.series = echartsData.value.options.series.sort((a: any, b: any) => {
|
||||
// return a.yAxisIndex - b.yAxisIndex
|
||||
// })
|
||||
console.log(echartsData.value.options.series, '...............709')
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user