|
|
@ -1,10 +1,9 @@ |
|
|
import dateService from '@/service/dateService'; |
|
|
import dateService from '@/service/dateService'; |
|
|
import utilService from '@/service/utilService'; |
|
|
import utilService from '@/service/utilService'; |
|
|
import { IObject } from '@/types/interface'; |
|
|
import { IObject } from '@/types/interface'; |
|
|
import { Legend } from 'highcharts'; |
|
|
|
|
|
import moment from 'moment'; |
|
|
import moment from 'moment'; |
|
|
|
|
|
|
|
|
export const monthEnergyUsageTrend = (data = []): IObject => { |
|
|
|
|
|
|
|
|
export const monthEnergyUsageTrend = (data = [], unit?: string): IObject => { |
|
|
const length = new dateService().getDateCountByMonth()[12]; |
|
|
const length = new dateService().getDateCountByMonth()[12]; |
|
|
const xAxisData = Array.from({ length }, (x, i) => i + 1); |
|
|
const xAxisData = Array.from({ length }, (x, i) => i + 1); |
|
|
const seriesData = []; |
|
|
const seriesData = []; |
|
|
@ -21,12 +20,28 @@ export const monthEnergyUsageTrend = (data = []): IObject => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
tooltip: { |
|
|
|
|
|
trigger: 'axis', |
|
|
|
|
|
formatter: (params: Array<IObject>) => { |
|
|
|
|
|
if (utilService.isValidArray(params)) { |
|
|
|
|
|
const [first] = params; |
|
|
|
|
|
const { axisValue } = first; |
|
|
|
|
|
|
|
|
|
|
|
let str = `<div>${axisValue}日</div><div>`; |
|
|
|
|
|
for (const item of params) { |
|
|
|
|
|
const { data } = item; |
|
|
|
|
|
str += `<div style="display: flex;justify-content: space-between;"><span>${item.marker}</span> <span><b>${data}</b> ${unit}</span></div>`; |
|
|
|
|
|
} |
|
|
|
|
|
return str + '</div>'; |
|
|
|
|
|
} |
|
|
|
|
|
return ''; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
grid: { |
|
|
grid: { |
|
|
bottom: 45, |
|
|
bottom: 45, |
|
|
top: 30, |
|
|
top: 30, |
|
|
left: 60, |
|
|
left: 60, |
|
|
}, |
|
|
}, |
|
|
tooltip: { trigger: 'axis' }, |
|
|
|
|
|
xAxis: { |
|
|
xAxis: { |
|
|
name: '(日)', |
|
|
name: '(日)', |
|
|
type: 'category', |
|
|
type: 'category', |
|
|
@ -424,7 +439,7 @@ export const energyUsageDistribution = (data = []): IObject => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
const energyMap: Array<IObject> = [ |
|
|
const energyMap: Array<IObject> = [ |
|
|
{ key: 'A29hh', name: '电用量', unit: '万kWh', color: '#0084FF' }, |
|
|
|
|
|
|
|
|
{ key: 'A29hh', name: '电用量', unit: 'kWh', color: '#0084FF' }, |
|
|
{ key: 'E3hh', name: '蒸汽用量', unit: 't', color: '#FFE777' }, |
|
|
{ key: 'E3hh', name: '蒸汽用量', unit: 't', color: '#FFE777' }, |
|
|
{ key: 'B2hh', name: '水用量', unit: 't', color: '#37FFC9' }, |
|
|
{ key: 'B2hh', name: '水用量', unit: 't', color: '#37FFC9' }, |
|
|
{ key: 'C2hh', name: '压缩空气用量', unit: 'Nm³', color: '#19D6FF' }, |
|
|
{ key: 'C2hh', name: '压缩空气用量', unit: 'Nm³', color: '#19D6FF' }, |
|
|
|