美文网首页
[tricks] 轴线标签换行 使用\n

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

作者: JamesSawyer | 来源:发表于2017-10-28 17:00 被阅读7次

    配置:

    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

          本文链接:https://www.haomeiwen.com/subject/smespxtx.html