每次写echarts 修改样式时,要么就是翻以前代码,要么找官方api,太浪费时间了,就把常用到的一些记录下来做个笔记,方便下次查看。
1.修改柱条颜色
1.1修改柱条颜色为纯色
series: [
{
name: '个数',
type: 'bar',
label: {
normal: {
show: true,
position: 'inside'
}
},
data: [],
itemStyle:{ //修改柱条颜色
color: '#f00'
},
barMaxWidth:40
},
]
1.2 修改柱条颜色为渐变色
series: [
{
name: '个数',
type: 'bar',
label: {
normal: {
show: true,
position: 'inside'
}
},
data: [],
itemStyle:{ //修改柱条颜色
color: new echarts.graphic.LinearGradient(
0, 0, 1, 0,
[
{offset: 1, color: &#