series: [{
name: '威胁值',
type: 'bar',
barWidth:70,
data: [30,49,26, 60, 26], //数据
itemStyle: {
normal: {
//由上到下的渐变
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#2864C8'
}, {
offset: 1,
color: '#9AC2FF'
}]),
shadowColor: 'rgba(0, 0, 0, 0.4)',//阴影
shadowBlur: 20//阴影宽度
}
},
}]
以上这个是柱状图添加渐变背景,主要是itemStyle属性。
//堆叠面积图
series: [{
name: 'Email',
type: 'line',
stack: 'Total',
areaStyle: {},
emphasis: {
focus: 'series'
},
data: [120, 132, 101, 134, 90, 230, 210],
areaStyle: {//区域填充渐变颜色
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'rgba(237,66,100, 0.5)' // 0% 处的颜色
}, {
offset: 1, color: 'rgba(234,174,10, 0)' // 100% 处的颜色
}],
global: false // 缺省为 false
}
}
},
{
name: 'Union Ads',
type: 'line',
stack: 'Total',
areaStyle: {},
emphasis: {
focus: 'series'
},
data: [220, 182, 191, 234, 290, 330, 310],
areaStyle: {//区域填充渐变颜色
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: 'rgb(44, 222, 44)' // 0% 处的颜色
}, {
offset: 1, color: 'rgba(234,174,10, 0)' // 100% 处的颜色
}],
global: false // 缺省为 false
}
}
}]
以上这个是堆叠面积折线图,主要是areaStyle属性。