ECharts对堆叠柱进行的多次扣减,每个堆叠的柱都被扣减了yAxis .min导致显示异常
使用场景:班级成绩的区间 由于班级分数区间集中在60~100分 所有50以下的Y坐标轴显示无意义,进行 yAxis.min的设置
配置项如下
options = [{
title: {
//text: '與群體評測結果比較',
},
legend: {
left: 'right',
data: ['團隊區間']
},
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
},
yAxis: {
type: 'value',
//min: 2.0,
max: 5.0
},
series: [{
name: '最小值',
type: 'bar',
stack: '总量',
barWidth: '40%',
itemStyle: {
normal: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
},
emphasis: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
}
},
data: [3.1, 3.3, 3.0, 3.4, 3.1, 2.9, 2.9, 3.3, 2.8, 3.4]
},
{
name: '團隊區間',
type: 'bar',
barWidth: '40%',
color: ['#aaa'],
stack: '总量',
data: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
}
]
},
{
title: {
//text: '與群體評測結果比較',
},
legend: {
left: 'right',
data: ['團隊區間']
},
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
},
yAxis: {
type: 'value',
min: 2.0,
max: 5.0
},
series: [{
name: '最小值',
type: 'bar',
stack: '总量',
barWidth: '40%',
itemStyle: {
normal: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
},
emphasis: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
}
},
data: [3.1, 3.3, 3.0, 3.4, 3.1, 2.9, 2.9, 3.3, 2.8, 3.4]
},
{
name: '團隊區間',
type: 'bar',
barWidth: '40%',
color: ['#aaa'],
stack: '总量',
data: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
}
]
}
];