多 x 轴示例

发布时间:2024年01月08日

在这里插入图片描述

option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            crossStyle: {
                color: '#999'
            }
        }
    },
    toolbox: {
        feature: {
            dataView: {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar']},
            restore: {show: true},
            saveAsImage: {show: true}
        }
    },
    xAxis: [
        {
            type: 'category',
            data: ['39','40'],
            axisPointer: {
                type: 'shadow'
            },
            position:'bottom',
            offset:20,
            axisTick:{
               show:true,
               length:40,
               lineStyle:{
                   type:'dotted'
               }
            }
        },
        {
            type: 'category',
            data: ['9/25','9/26','9/27','9/28','9/29','9/30','10/1'
                  ,'10/2' ,'10/3' ,'10/4' ,'10/5' ,'10/6' ,'10/7','10/8'
            ],
            position:'bottom',
            axisPointer: {
                type: 'shadow'
            },
            axisTick:{
               show:true
            }
        },  

    ],
    yAxis: [
        {
            type: 'value',
            name: '水量',
            min: 0,
            max: 250,
            interval: 50,
            axisLabel: {
                formatter: '{value} ml'
            }
        },
        {
            type: 'value',
            name: '温度',
            min: 0,
            max: 25,
            interval: 5,
            axisLabel: {
                formatter: '{value} °C'
            }
        },
    ],
    series: [
        {
            name:'1周',
            type:'line',
            data:[211.9, 100.0]
        },
        {
            name:'主',
            type:'bar',
            data:[21.9, 2.9, 7.0, 23.2, 25.6,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.0, 4.9, 7.0, 23.2, 25.6,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.6, 5.9, 9.0, 26.4, 28.7,33.0,100.0]        },
              {
            name:'',
            type:'bar',
            data:[2.0, 4.9, 7.0, 23.2, 25.6,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            yAxisIndex: 1,
            data:[2.0, 2.2, 3.3, 4.5, 6.3,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.0, 2.2, 3.3, 4.5, 6.3,33.0,100.0]
        },
        {
            name:'',
            type:'bar',
            data:[2.0, 2.2, 3.3, 4.5, 6.3,33.0,100.0]
        }
    ]
};
文章来源:https://blog.csdn.net/qq_44871531/article/details/135461974
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。