策略曲线

This commit is contained in:
白菜
2025-07-23 21:22:21 +08:00
parent 000c8fec25
commit f71119885a
2 changed files with 28 additions and 10 deletions

View File

@ -277,10 +277,10 @@ export function setTimeConfigList(data) {
}) })
} }
// 策略曲线图 // 策略曲线图
//http://localhost:8089/strategy/curve/list?strategyId=1&siteId=021_FXX_01 //http://localhost:8089/strategy/curve/curveList?strategyId=1&siteId=021_FXX_01
export function curveList({siteId,strategyId}) { export function curveList({siteId,strategyId}) {
return request({ return request({
url: `/strategy/curve/list?siteId=${siteId}&strategyId=${strategyId}`, url: `/strategy/curve/curveList?siteId=${siteId}&strategyId=${strategyId}`,
method: 'get', method: 'get',
}) })
} }

View File

@ -47,6 +47,26 @@ export default {
}, },
setOption(data) { setOption(data) {
if(!this.chart) return if(!this.chart) return
let obj = {}
for(var i=0;i<=23;i++){
obj[i] = {
title:i<=9?`0${i}:00` : `${i}:00`
}
}
const nowMonth = new Date().getMonth()+1;
const localMonth = data.find(item=>item.month === nowMonth)?.powerList || []
localMonth.forEach(item => {
const startHours = parseInt(item.startTime.split(':')[0], 10)
const endHours =parseInt(item.endTime.split(':')[0], 10)
for(let i=startHours;i<=endHours;i++){
obj[i].value = item.powerData
}
})
let source = [['时间','冲放功率']]
Object.values(obj).forEach(item => {
const {title,value} = item
source.push([title,value])
})
this.chart.setOption({ this.chart.setOption({
color:['#FFBD00','#3C81FF'], color:['#FFBD00','#3C81FF'],
legend: { legend: {
@ -63,7 +83,7 @@ export default {
color:"#333333", color:"#333333",
}, },
xAxis: { xAxis: {
data: ['01:00','02:00','03:00','05:00','06:00','07:00','08:00','09:00','10:00'], type: 'category',
axisLine: { axisLine: {
lineStyle:{ lineStyle:{
color: '#333333', color: '#333333',
@ -78,16 +98,14 @@ export default {
} }
} }
}, },
dataset: {
source
},
series: [ series: [
{ {
name:'模板一', name:'冲放功率',
data: [80,92,1,34,90,130,320,80,9,91],
type: 'line', type: 'line',
},{ }]
name:'模板二',
data: [820,932,901,934,1290,1330,1320,820,932,901],
type: 'line',
}]
}) })
} }
} }