Echarts 双y轴双折线图
js code
option = {
title: {
text: '折线图堆叠'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['温度', '湿度']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: true,
data: ['周一', '周二', '周三', '周四', '周五']
},
yAxis: [
{
type: 'value',
name: '℃',
//坐标轴最大值、最小值、强制设置数据的步长间隔
interval: 5,
axisLabel: {
//y轴上带的单位
formatter: '{value}'
},
//轴线
axisLine: {
show: true
},
//分割线
splitLine: {
show: false
}
},
{
type: 'value',
name: 'RH%',
axisLabel: {
formatter: '{value}'
},
//轴线
axisLine: {
show: true
},
//分割线
splitLine: {
show: false
}
}
],
series: [
{
name: '温度',
type: 'line',
yAxisIndex: 0,
data: [10,23,30,50,50],
}, {
name: '湿度',
type: 'line',
yAxisIndex: 1,
data: [15,10,20,25,30],
}
]
};
结果
版权声明:本文为qq_27242695原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。