echarts设置标题

echarts yekong

echarts设置标题是通过title字段进行控制的.
通过textStyle对标题的样式和位置进行修饰

title: {
        text: '这里是标题',
        textStyle: {
            align: 'center',
            color: 'red',
            fontSize: 20,
        },
        top: '5%',
        left: 'center',
    },

wanjunshijiecom 2021-08-17 at 06.02.44

option = {
    title: {
        text: '这里是标题',
        textStyle: {
            align: 'center',
            color: 'red',
            fontSize: 20,
        },
        top: '5%',
        left: 'center',
    },
    xAxis: {
        data: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
    },
    yAxis: {show:false},
    series: [{
        type: 'bar',
        data:[220, 182, 191, 234, 290, 330, 310]
    }]
};

喜欢