2025-09-02 14:27:50 +08:00
|
|
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
|
|
|
import { EnergyConsumptionTrendConfig } from './index'
|
|
|
|
import { CreateComponentType } from '@/packages/index.d'
|
|
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
|
|
import dataJson from './data.json'
|
2025-09-02 20:21:06 +08:00
|
|
|
import * as echarts from 'echarts'
|
2025-09-02 14:27:50 +08:00
|
|
|
|
2025-09-03 11:00:44 +08:00
|
|
|
export const includes = []
|
|
|
|
const otherOption = {
|
2025-09-04 09:45:21 +08:00
|
|
|
sceneCode: '',
|
2025-09-04 09:23:04 +08:00
|
|
|
titleText:'能源趋势',
|
2025-09-03 21:17:52 +08:00
|
|
|
unit: dataJson.unit,
|
2025-09-03 11:00:44 +08:00
|
|
|
}
|
2025-09-02 14:27:50 +08:00
|
|
|
|
|
|
|
const option = {
|
2025-09-03 11:00:44 +08:00
|
|
|
...otherOption,
|
|
|
|
dataset: dataJson,
|
|
|
|
// 添加标题配置
|
|
|
|
title: {
|
|
|
|
text: '单位:' + otherOption.unit,
|
2025-09-04 09:23:04 +08:00
|
|
|
left: '2%',
|
|
|
|
top: '2%',
|
2025-09-03 11:00:44 +08:00
|
|
|
textStyle: {
|
|
|
|
fontSize: 12,
|
|
|
|
color: 'rgba(255, 255, 255, 0.7)',
|
|
|
|
fontWeight: 'normal'
|
|
|
|
}
|
|
|
|
},
|
2025-09-02 20:21:06 +08:00
|
|
|
// 提示框配置
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
2025-09-02 14:27:50 +08:00
|
|
|
axisPointer: {
|
2025-09-02 20:21:06 +08:00
|
|
|
type: 'shadow'
|
2025-09-02 14:27:50 +08:00
|
|
|
},
|
2025-09-02 20:21:06 +08:00
|
|
|
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
|
|
borderColor: '#00ffff',
|
|
|
|
textStyle: {
|
|
|
|
color: '#ffffff'
|
2025-09-02 14:27:50 +08:00
|
|
|
}
|
|
|
|
},
|
2025-09-02 20:21:06 +08:00
|
|
|
// 网格配置
|
|
|
|
grid: {
|
|
|
|
left: '3%',
|
|
|
|
right: '4%',
|
|
|
|
bottom: '3%',
|
|
|
|
top: '15%',
|
|
|
|
containLabel: true
|
|
|
|
},
|
|
|
|
|
|
|
|
// X轴配置
|
|
|
|
xAxis: {
|
2025-09-02 14:27:50 +08:00
|
|
|
type: 'category',
|
|
|
|
axisLine: {
|
|
|
|
lineStyle: {
|
2025-09-03 11:00:44 +08:00
|
|
|
color: 'rgba(255, 255, 255, 0.1)',
|
2025-09-02 14:27:50 +08:00
|
|
|
}
|
2025-09-02 20:21:06 +08:00
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
//
|
|
|
|
axisLabel: {
|
2025-09-03 11:00:44 +08:00
|
|
|
color: '#eee',
|
2025-09-02 20:21:06 +08:00
|
|
|
interval: 0,
|
|
|
|
fontSize: 9,
|
|
|
|
margin: 20
|
2025-09-02 14:27:50 +08:00
|
|
|
}
|
2025-09-02 20:21:06 +08:00
|
|
|
|
2025-09-02 14:27:50 +08:00
|
|
|
},
|
2025-09-02 20:21:06 +08:00
|
|
|
|
|
|
|
// Y轴配置
|
|
|
|
yAxis: {
|
2025-09-02 14:27:50 +08:00
|
|
|
type: 'value',
|
|
|
|
min: 0,
|
2025-09-02 20:21:06 +08:00
|
|
|
interval: 25,
|
2025-09-02 14:27:50 +08:00
|
|
|
axisLine: {
|
2025-09-03 11:00:44 +08:00
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
color: 'rgba(255, 255, 255, 0.1)',
|
|
|
|
}
|
2025-09-02 20:21:06 +08:00
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
|
|
formatter: '{value}'
|
2025-09-02 14:27:50 +08:00
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
lineStyle: {
|
2025-09-02 20:21:06 +08:00
|
|
|
color: 'rgba(255, 255, 255, 0.1)',
|
|
|
|
type: 'solid'
|
2025-09-02 14:27:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2025-09-02 20:21:06 +08:00
|
|
|
|
|
|
|
// 数据系列配置
|
2025-09-02 14:27:50 +08:00
|
|
|
series: [{
|
2025-09-02 20:21:06 +08:00
|
|
|
name: '能源消耗',
|
|
|
|
type: 'bar',
|
|
|
|
itemStyle: {
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
2025-09-03 22:27:23 +08:00
|
|
|
{ offset: 0, color: 'rgba(2, 206, 214, 0.8)' }, // 更暗的左侧颜色,增强阴影效果
|
|
|
|
// { offset: 0.2, color: '#00bfbf' }, // 左侧过渡色
|
|
|
|
{ offset: 0.5, color: 'rgba(44, 162, 163, 0.5)' }, // 中间主色
|
|
|
|
// { offset: 0.8, color: '#00bfbf' }, // 右侧过渡色
|
|
|
|
{ offset: 1, color: 'rgba(25, 217, 170, 0.8)' } // 右侧亮色,增强高光效果
|
2025-09-02 20:21:06 +08:00
|
|
|
]),
|
2025-09-03 22:27:23 +08:00
|
|
|
opacity: 0.80,
|
2025-09-02 20:21:06 +08:00
|
|
|
// 添加更强的3D效果
|
|
|
|
shadowBlur: 20,
|
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.7)',
|
|
|
|
shadowOffsetX: -5,
|
|
|
|
shadowOffsetY: 5,
|
2025-09-03 22:27:23 +08:00
|
|
|
borderRadius: [0, 0, 5, 5],
|
2025-09-02 20:21:06 +08:00
|
|
|
borderWidth: 0,
|
|
|
|
|
|
|
|
},
|
|
|
|
emphasis: {
|
|
|
|
itemStyle: {
|
|
|
|
shadowColor: 'rgba(0, 255, 255, 0.9)',
|
|
|
|
shadowBlur: 25,
|
|
|
|
shadowOffsetX: -8,
|
|
|
|
shadowOffsetY: 8
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// })),
|
|
|
|
|
2025-09-03 11:00:44 +08:00
|
|
|
barWidth: '45%',
|
2025-09-02 20:21:06 +08:00
|
|
|
|
|
|
|
// 3D圆柱体效果
|
2025-09-03 11:00:44 +08:00
|
|
|
roundCap: false
|
2025-09-02 20:21:06 +08:00
|
|
|
}, {
|
|
|
|
type: 'pictorialBar',
|
|
|
|
z: 3,
|
2025-09-03 22:27:23 +08:00
|
|
|
symbolSize: ['65%', '5'],
|
2025-09-03 11:00:44 +08:00
|
|
|
symbolOffset: [0.1, -3],
|
2025-09-02 20:21:06 +08:00
|
|
|
symbolPosition: "end",
|
2025-09-02 14:27:50 +08:00
|
|
|
itemStyle: {
|
2025-09-03 22:27:23 +08:00
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
|
{ offset: 0, color: 'rgba(2, 206, 214, 0.8)' }, // 更暗的左侧颜色,增强阴影效果
|
|
|
|
{ offset: 1, color: 'rgba(25, 217, 170, 0.8)' } // 右侧亮色,增强高光效果
|
|
|
|
]),
|
2025-09-02 14:27:50 +08:00
|
|
|
},
|
2025-09-03 11:00:44 +08:00
|
|
|
// opacity: 0.1,
|
2025-09-02 14:27:50 +08:00
|
|
|
emphasis: {
|
2025-09-02 20:21:06 +08:00
|
|
|
itemStyle: {
|
2025-09-03 22:27:23 +08:00
|
|
|
shadowColor: "rgba(51, 221, 221, 0.9)",
|
2025-09-02 20:21:06 +08:00
|
|
|
shadowBlur: 12
|
2025-09-02 14:27:50 +08:00
|
|
|
}
|
|
|
|
}
|
2025-09-02 20:21:06 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
// 图形元素配置
|
|
|
|
graphic: [{
|
|
|
|
// 左侧阴影效果
|
|
|
|
type: 'rect',
|
|
|
|
left: 0,
|
|
|
|
top: '15%',
|
|
|
|
width: '25%',
|
|
|
|
bottom: '3%',
|
|
|
|
style: {
|
|
|
|
fill: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
|
{ offset: 0, color: 'rgba(0, 0, 0, 0.8)' }, // 更强的左侧阴影
|
|
|
|
{ offset: 1, color: 'rgba(0, 0, 0, 0)' }
|
|
|
|
])
|
|
|
|
},
|
|
|
|
z: -1
|
|
|
|
}, {
|
|
|
|
// 底部阴影效果
|
|
|
|
type: 'rect',
|
|
|
|
left: '3%',
|
|
|
|
right: '4%',
|
|
|
|
bottom: '0',
|
|
|
|
height: '10%',
|
|
|
|
style: {
|
|
|
|
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
{ offset: 0, color: 'rgba(0, 0, 0, 0)' },
|
|
|
|
{ offset: 1, color: 'rgba(0, 0, 0, 0.6)' } // 底部阴影
|
|
|
|
])
|
|
|
|
},
|
|
|
|
z: -1
|
2025-09-02 14:27:50 +08:00
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
|
|
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
|
|
|
public key: string = EnergyConsumptionTrendConfig.key
|
|
|
|
public chartConfig = cloneDeep(EnergyConsumptionTrendConfig)
|
|
|
|
// 图表配置项
|
|
|
|
public option = echartOptionProfixHandle(option, includes)
|
|
|
|
}
|