统计分析
This commit is contained in:
parent
0b80076d24
commit
a3c29f08b1
@ -340,9 +340,12 @@ const getTimeIntervals = (startTimestamp, endTimestamp) => {
|
|||||||
|
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
const calculate = reactive([{ max: '', min: '', average: '' }])
|
||||||
|
var xDatas = []
|
||||||
const statAnalysisOperate = () => {
|
const statAnalysisOperate = () => {
|
||||||
option.series = []
|
option.series = []
|
||||||
option.legend.data = []
|
option.legend.data = []
|
||||||
|
xDatas = []
|
||||||
chart.value.setOption(option, { notMerge: true })
|
chart.value.setOption(option, { notMerge: true })
|
||||||
times.forEach((time, index) => {
|
times.forEach((time, index) => {
|
||||||
if (time[0] && time[1]) {
|
if (time[0] && time[1]) {
|
||||||
@ -361,8 +364,7 @@ const statAnalysisOperate = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const calculate = reactive([{ max: '', min: '', average: '' }])
|
|
||||||
const xDatas = reactive([])
|
|
||||||
const historyDataReq = (data, index) => {
|
const historyDataReq = (data, index) => {
|
||||||
historyReq(data).then((res) => {
|
historyReq(data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -377,12 +379,15 @@ const historyDataReq = (data, index) => {
|
|||||||
min: Math.floor(Math.min(...yData)),
|
min: Math.floor(Math.min(...yData)),
|
||||||
average: Math.floor(yData.reduce((a, b) => a + b, 0) / yData.length),
|
average: Math.floor(yData.reduce((a, b) => a + b, 0) / yData.length),
|
||||||
}
|
}
|
||||||
xDatas.push(xData)
|
xDatas.push({
|
||||||
|
series: String(customName[index]),
|
||||||
|
data: xData,
|
||||||
|
})
|
||||||
option.tooltip = {
|
option.tooltip = {
|
||||||
show: true,
|
show: true,
|
||||||
formatter: function (params) {
|
formatter: function (params) {
|
||||||
const index = customName.indexOf(params.seriesName)
|
const matchData = xDatas.filter((x) => x.series == params.seriesName)
|
||||||
const x = timestampToTime(xDatas[index][params.dataIndex])
|
const x = timestampToTime(matchData[0]['data'][params.dataIndex])
|
||||||
return `${params.marker} ${params.seriesName} <br/> ${x} <b>${params.data}</b>`
|
return `${params.marker} ${params.seriesName} <br/> ${x} <b>${params.data}</b>`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -391,6 +396,7 @@ const historyDataReq = (data, index) => {
|
|||||||
name: customName[index],
|
name: customName[index],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: yData,
|
data: yData,
|
||||||
|
showSymbol: true,
|
||||||
}
|
}
|
||||||
option.legend.data.push(customName[index])
|
option.legend.data.push(customName[index])
|
||||||
option.series.push(seriesData)
|
option.series.push(seriesData)
|
||||||
|
@ -197,6 +197,9 @@ const option = {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: [],
|
data: [],
|
||||||
|
axisLabel: {
|
||||||
|
rotate: 15,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
|
Loading…
Reference in New Issue
Block a user