1. 程式人生 > >echarts 修改 X軸、Y軸及圖例的文字樣色及大小

echarts 修改 X軸、Y軸及圖例的文字樣色及大小

 最近做資料視覺化,一直跟圖表打交道,遇到了一個修改 圖例(legend)及軸上文字的顏色及大小的需求

legend: {
        left: 'left',
        data: ['2的指數', '3的指數'],
        textStyle: {
            color: 'red',
            fontSize: 18
        }
},
    xAxis: {
        type: 'category',
        name: 'x',
        splitLine: {show: false},
        data: ['一', '二', '三', '四', '五', '六', '七', '八', '九'],
        axisLabel: {
            show: true,
            textStyle: {
                color: 'red'
            }
        }
    },

修改後效果如下: