默认的顺序是按照legend顺序从下向上堆积,怎么设置可以反过来呢
配置项如下
option = {
tooltip: {
show: true,
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data: ['周一','周二','周三','周四']
},
color: ['red', 'yellow', 'blue', 'green'],
xAxis: {
type: 'category',
data: ['毛衣', '牛仔裤', '秋裤', '羽绒服', '风衣']
},
yAxis: {
type: 'value',
},
series: [{
name: '周一',
type: 'bar',
stack: '销量',
data: [6, 2, 1, 1, 10]
},{
name: '周二',
type: 'bar',
stack: '销量',
data: [10, 2, 11, 14, 3]
}, {
name: '周三',
type: 'bar',
stack: '销量',
data: [15, 2, 1, 14, 7]
}, {
name: '周四',
type: 'bar',
stack: '销量',
data: [2, 12, 11, 2, 4]
}]
}