barChartOption.js 2.79 KB
/*横向柱状图样式*/
function getXOption(){
    var option = {
        title : {
            text: '全站销售地域 top10:',
            subtext: 'From ExcelHome'
        },
        xAxis : [
            {
                type:'value',
                show:false
            }
        ],
        yAxis : [
            {
                type:'category',
                data:['福建','澳门','香港','重庆','天津','北京','浙江','江苏','上海','广东'],
                axisLine:{
                    show:false
                },
                axisTick:{
                    show:false
                },
                splitLine:{
                    show:false
                }
            }
        ],
        series : [
            {
                name:'销量',
                type:'bar',
                data:[0.5, 1.5, 2.3, 3.4, 4.2, 6.7, 8.2, 14.6, 16.2, 18.7],
                itemStyle: {
                    normal: {
                        color: '#ccc',
                        barBorderColor: '#ccc',
                        label : {
                            show: true,
                            position: 'right',
                            textStyle:{
                                color:"#585858",
                                align:"right",
                                baseline:"top"
                            }
                        }
                    }
                }
            }
        ]
    };
    return option;
}

/*纵向柱状图样式*/
function getYOption(){
    var option = {
        title : {
            text: '消费水平',
            subtext: '123'
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:['Vans旗舰店','YOHO!'],
            show:true
        },
        xAxis : [
            {
                type : 'category',
                data : ['1000以上','600~1000','300~600','100~300','0~100'],
                name:'金额\n(元)',
                nameLocation:'start',
                axisTick:{
                    show:false
                },
                splitLine:{
                    show:false
                }
            }
        ],
        yAxis : [
            {
                type : 'value',
                position: 'right',
                axisLine:{
                    show:false
                },
                axisTick:{
                    show:false
                }
            }
        ],
        series : [
            {
                name:'Vans旗舰店',
                type:'bar',
                data:[2.0, 4.9, 7.0, 23.2, 25.6],
                barGap:'0'
            },
            {
                name:'YOHO!',
                type:'bar',
                data:[2.6, 5.9, 9.0, 26.4, 28.7]
            }
        ]
    };
    return option;
}