能源分析
This commit is contained in:
@@ -48,13 +48,39 @@ export default {
|
||||
}
|
||||
this.chartDom = document.getElementById('analysischartBar')
|
||||
this.chart = echarts.init(this.chartDom)
|
||||
let tempArr = []
|
||||
let xData = []
|
||||
let yData = []
|
||||
let legendData = []
|
||||
if (this.chartData.length === 0) {
|
||||
return false
|
||||
} else {
|
||||
tempArr = this.chartData[0].trendRespVOList
|
||||
}
|
||||
for (let k = 0; k < tempArr.length; k++) {
|
||||
xData.push(tempArr[k].time)
|
||||
}
|
||||
for (let i = 0; i < this.chartData.length; i++) {
|
||||
xData.push(this.chartData[i].time)
|
||||
yData.push(this.chartData[i].useNum)
|
||||
let obj = {
|
||||
name: this.chartData[i].objName + this.chartData[i].objCode,
|
||||
type: 'bar',
|
||||
data: []
|
||||
}
|
||||
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
|
||||
let temp = this.chartData[i].trendRespVOList
|
||||
for (let j = 0; j < temp.length; j++) {
|
||||
let num = temp[j].useNum ? temp[j].useNum : 0
|
||||
obj.data.push(num)
|
||||
}
|
||||
yData.push(obj)
|
||||
}
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: legendData
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData
|
||||
@@ -62,12 +88,7 @@ export default {
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: yData,
|
||||
type: 'bar'
|
||||
}
|
||||
]
|
||||
series: yData
|
||||
};
|
||||
|
||||
option && this.chart.setOption(option);
|
||||
|
||||
Reference in New Issue
Block a user