BarChartOptions.js
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* @Description:
* @Author: huyue
* @Date: 2023-07-07 14:04:52
* @LastEditors: huyue
* @LastEditTime: 2023-07-11 16:04:06
*/
import * as echarts from 'echarts'
function getBarOptions(obj) {
const { tooltipFormatter } = obj
var barLineOption = {
// tooltip: {
// trigger: 'axis',
// borderWidth: 0,
// padding: 0,
// formatter: tooltipFormatter || '',
// confine: true
// },
barWidth: 14,
xAxis: {
data: []
},
yAxis: {
name: '',
type: 'value',
interval: 250,
splitLine: {
lineStyle: {
color: '#1d2a38'
}
}
},
grid: {
left: '3%',
right: '4%',
top: '20%',
bottom: '6%',
containLabel: true
},
series: [
{
name: 'bar',
type: 'bar',
data: [],
label: {
show: true,
position: 'top',
color: '#fff'
},
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: '#00C8FF'
}, // 柱图渐变色
// {
// offset: 0.5, // 指100%处的颜色
// color: '#223FA9'
// },
{
offset: 1, // 指100%处的颜色
color: '#0069F2'
}]
)
}
}
},
]
}
return barLineOption
}
export default getBarOptions