Echarts将Y轴数据放入图表内,显示数据范围

将Y轴数据靠右,并且显示数据范围

Echarts将Y轴数据放入图表内,显示数据范围_第1张图片

option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value',
        axisLabel:{
            inside : true,
            verticalAlign : "top",
            margin : 20,
            fontSize:30,
            padding: [50, 4, 5, 6],
            formatter: function (value, index) {
                if(index === 0){
                    return "";
                }
                var result = value*(index-1)/index+' ~ '+value+' %';
                return result;
            },
            textStyle: {
                color: function (value, index) {
                    return value >= 60 ? 'RGBA(100,200,100,0.8)' : 'RGBA(255,0,0,0.2)';
                }
            }

        },
        splitArea: {
            show:true,
            areaStyle: {
                color : [
                    'rgba(230,230,230,0.6)',
                    'rgba(100,100,200,0.3)'
                ] 
            } 
        }
    },
    series: [{
        data: [20, 30, 80, 46, 32, 93, 77],
        type: 'line',
        smooth: true
    }]
};

 

你可能感兴趣的:(echart)