echarts x轴分两级显示

代码

option = {
    xAxis: [
    {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun','Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        axisTick: {
            length:20
        },
    },
    {
        type: 'category', 
        data: [
            {
                value: 'First week',
                textStyle: {
                    fontSize: 18,
                    lineHeight: 70
                }
            },{
                value: 'Second weeks',
                textStyle: {
                    fontSize: 18,
                    lineHeight: 70
                }
            }  
        ],
        position : 'bottom',
        axisTick: {
            length:50
        },
        splitArea: {
            show: true,
            areaStyle: {
                color: ['rgba(255,255,255,0.5)','rgba(200,200,200,0.5)']
            }
        }
    },

    ],
    yAxis: {
        type: 'value'
    },
    series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320, 820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line'
    }]
};

结果
在这里插入图片描述

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页