柱线混合图中,柱状图的y轴在左边,折线图的y轴在右边,柱状图的y轴如果不从0开始时,柱状图在轴线下方会多出一块,只有当折线图的y轴也不从0开始的时候,这多出来的一块才会不见
配置项如下
app.title = '折柱混合,y轴不从0开始';
option = {
tooltip: {
trigger: 'axis'
},
toolbox: {
feature: {
dataView: {show: true, readOnly: false},
magicType: {show: true, type: ['line', 'bar']},
restore: {show: true},
saveAsImage: {show: true}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
legend: {
data:['降水量','平均温度']
},
xAxis: [
{
type: 'category',
data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '水量',
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '温度',
axisLabel: {
formatter: '{value} °C'
}
}
],
series: [
{
name:'降水量',
type:'bar',
data:[440, 420, 410, 440, 450, 460, 450.6, 430, 420, 410, 455, 432]
},
{
name:'平均温度',
type:'line',
yAxisIndex: 1,
data:[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1]
}
]
};