[tricks] 轴线标签换行 使用\n

配置:

xAxis: [
        {
            type: 'category',
            name: '月份',
            axisTick: {
                alignWithLabel: true
            },
            data: [{
                value: '1月',
                textStyle: {
                    fontSize: 20,
                    color:'red'
                }
            },'2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
            splitLine: {
                lineStyle: {
                    color: 'red'
                }
            }
        },   
    ],
#1 被挡住.png

使用 \n 进行换行

xAxis: [
        {
            type: 'category',
            // position: 'top',
            name: '\n\n月份', // 换行
            // name: '月份',
            // maxInterval: 2,
            axisTick: {
                alignWithLabel: true
            },
            data: [{
                value: '1月',
                textStyle: {
                    fontSize: 20,
                    color:'red'
                }
            },'2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
            splitLine: {
                lineStyle: {
                    color: 'red'
                }
            }
        },     
    ],
#2 换行.png

你可能感兴趣的:([tricks] 轴线标签换行 使用\n)