左右两条Y轴
yAxis: [
{
type: 'value',
position: 'left',//显示在左边还是右边
alignTicks: true,
//offset: 80, 位置偏移
axisLabel: {
formatter: (params) => {
return params / 10000 + 'w';
},
textStyle: { fontSize: 12 }
}
},
{
type: 'value',
position: 'right',
alignTicks: true,
axisLabel: { formatter: '{value}%', textStyle: { fontSize: 12 } }
}
],
series: [
{
name: '销售额',
type: 'line',
yAxisIndex: 0,//对应的yAxis对应的索引
itemStyle: { color: '#2F54EB' },
smooth: true,
data: [326675, 372852, 649737, 176995, 10639, 765145]
},
{
name: '会员占比',
type: 'bar',
itemStyle: { color: '#C6CAD3', barBorderRadius: 16 },
tooltip: {
valueFormatter: (params) => {
return params + '%';
}
},
barMaxWidth: 30,
barMinWidth: 16,
yAxisIndex: 1,//对应的yAxis对应的索引
data: [9.1, 19.8, 27.5, 6.5, 0.5, 36.6]
}
]