2024.3.12今天我学习了如何用echarts line实现设备开关状态的效果。
代码如下:
option = {xAxis: {type: 'time',},yAxis: {type: 'value',splitNumber:2,// axisLine: {// show: true,// lineStyle: {// color:'#808080'// }// },axisLabel:{formatter:function(value){if(value===1){return '泵1'}else if(value===2){return '泵2'}}}},series: [{data: [['2022-10-25 08:00',1], ['2022-10-25 09:00',1],['2022-10-25 10:00',null], ['2022-10-25 11:00',1], ['2022-10-25 12:00',1],['2022-10-25 13:00',null],['2022-10-25 14:00',1],['2022-10-25 14:30',1],['2022-10-25 15:00',null],['2022-10-25 16:00',1]],type: 'line',symbol: 'none',name:'泵1'},{data: [['2022-10-25 08:00',2], ['2022-10-25 09:00',null],['2022-10-25 10:00',2], ['2022-10-25 11:00',2],['2022-10-25 12:00',2],['2022-10-25 13:00',null], ['2022-10-25 14:00',2],['2022-10-25 14:30',2], ['2022-10-25 15:00',null], ['2022-10-25 16:00',2]],type: 'line',symbol: 'none',name:'泵2'}]
};