echarts圖表的y軸刻度和數值在圖表內部

option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value',
        axisTick: {
            inside: true
        },
        axisLabel: {
            inside: true
        }
    },
    series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line'
    }]
};

 

業務中想要圖表的位置一直固定住,就y軸而言,就不能讓它的刻度值在左邊,因爲刻度值的大小是不可能不變的,放在圖表內部,就不會影響y軸的位置了,從而影響佈局;

不想要y軸的刻度值的話還可以這樣:

option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value',
        show: false,
        axisTick: {
            inside: true
        },
        axisLabel: {
            //inside: true,
            formatter(value) {
                return '';
            }
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true,
    },
    series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line'
    }],
};
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章