1.饼状图
option = {
tooltip: {
trigger: 'item'//鼠标悬停,显示提醒信息
},
legend: {//图例,各个颜色表达数据的说明
show:false,
top: '5%',
left: 'center'
},
2.柱状图
yAxis: {//y轴
type: 'category',
data: ['电磁灶', '洗碗机', '油烟机', '蒸柜', '电冰箱', '烤箱'],//y轴上的文字
inverse: true,
animationDuration: 1,
animationDurationUpdate: 1000,
max: 6, // only the largest 3 bars will be displayed
splitLine: {show: false},//y轴的横线
axisLabel: {
formatter: '{value}',
color: val => '#fff'
}//y轴文字设置
},
series: [//数据
{
label: {//数据块上的文字提示
show: true,
position: 'right',
valueAnimation: true,
fontStyle:'normal',
color:'#fff'
},
itemStyle: {//数据条渐变色
normal: {//颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{offset: 0, color: '#006EFF'},
{offset: 0.5, color: '#188df0'},
{offset: 1, color: '#4CFFFF'}
]),
barBorderRadius: 5
}
}