ECharts3实例 定制XY轴、柱状图

前言

     实现如下效果图

在这里插入图片描述

解决方法

option = {
    
    
    
    xAxis: {
    
    
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        axisPointer: {
    
     
            type: 'shadow'
        },
        axisLabel: {
    
    
            color: 'red'
        },
        axisTick: {
    
     show: false },
        //设置轴线的属性
        axisLine:{
    
    
            lineStyle:{
    
    
                color:'#ddd'
            }
        } 
    },
    yAxis: {
    
    
        type: 'value',
        axisLabel: {
    
    
            formatter: '{value} ml',
            color: '#fff'
        },
         axisLine:{
    
    
            lineStyle:{
    
    
                color:'#fff'
            }
        },
        splitLine:{
    
    
            lineStyle: {
    
    
                type: 'dashed',
                width: 2,
                color: 'red'
            }
      }
    },
    series: [{
    
    
        data: [120, 200, 150, 80, 70, 110, 130],
        type: 'bar',
        barMaxWidth: 40,
        itemStyle: {
    
    
            normal: {
    
    
                color: 'blue',
                //柱形图圆角,初始化效果
                barBorderRadius:[20, 20, 0, 0]
            }
        },
    }]
};

Guess you like

Origin blog.csdn.net/idomyway/article/details/111304953