运营获客KPI

描述:当前是关于Echarts图表中的 柱状图 示例。
 
            var data = [70, 34, 60, 78]
var titlename = ['自然', '拉新', '产邀', '整体'];
var valdata = [683, 234, 234, 523, 345]
var myColor = ['#ffc000', '#FCBADC', '#7BC77B','#6AC5EC'];
option = {
    backgroundColor: '#ffffff',
    xAxis: {
        show: true
    },
    yAxis: [{
        show: true,
        data: titlename,
        inverse: true,
        axisLine: {
            show: false
        },
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },
        axisLabel: {
            //color: '#fff',
            formatter: function(value, index) {
                return [
                    '{lg|' + (index + 1) + '}' + '{title|' + value + '} '
                ].join('\n')
            },
            rich: {
                lg: {
                    //backgroundColor: '#339911',
                    color: '#fff',
                    borderRadius: 15,
                    // padding: 5,
                    align: 'center',
                    width: 15,
                    height: 15
                },
            }
        },


    }, {
        show: true,
        inverse: true,
        data: valdata,
        axisLabel: {
            textStyle: {
                fontSize: 12,
                //color: '#fff',
            },
        },
        axisLine: {
            show: false
        },
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },

    }],
    series: [{
        name: '条',
        type: 'bar',
        yAxisIndex: 0,
        markLine: {
                data: [{
                    type: 'average',
                    name: '平均值',
                    color:'00ad4e'
                }]
            },
        data: data,
        barWidth: 50,
        itemStyle: {
            normal: {
                barBorderRadius: 30,
                color: function(params) {
                    var num = myColor.length;
                    return myColor[params.dataIndex % num]
                },
            }
        },
        label: {
            normal: {
                show: true,
                position: 'inside',
                formatter: '{c}%'
            }
        },
    }, ]
};