echarts 横向条状图

<!DOCTYPE html>
<html style="height: 100%">
   <head>
       <meta charset="utf-8">
   </head>
   <body style="height: 100%; margin: 0">
       <div id="container" style="height: 100%"></div>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/dataTool.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/china.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/world.js"></script>
       <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ZUONbpqGBsYGXNIYHicvbAbM"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/bmap.min.js"></script>
       <script type="text/javascript">
var dom = document.getElementById("container");
var myChart = echarts.init(dom);
var app = {};
option = null;
app.title = '世界人口总量 - 条形图';


option = {
    //  title : {
    //     text: '世界人口总量',
    //     subtext: '数据来自网络'
    // },
    // tooltip: {
    //     trigger: 'axis',
    //     // axisPointer: {
    //     //     type: 'shadow'
    //     // }
    // },
    // legend: {
    //     data: ['2011年']
    // },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
         show: false,
        boundaryGap: [0, 0.01],
    },
    yAxis: {
        type: 'category',
        data: ['6 招商银行','5 广发银行','4 工商银行','3 农业银行','2 中国银行','1 交通银行'],
        axisLine: { show: false},
        axisTick: {show: false},
    },
     color:['#2c3f6a','#21927e'],  
    series: [
        {
            name: '2011年',
            type: 'bar',
            barWidth: 15,
                itemStyle: {
                    normal: {
                        barBorderRadius: 40,
                        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                            offset: 0,
                            color: '#2d3d69'
                        }, {
                            offset: 1,
                            color: '#2b3c67'
                        }]),
                        // shadowColor: 'rgba(35,149,229,0.8)',
                        // shadowBlur: 20,
                        areaStyle: {type: 'default'},
                 label : {
                    show: true, 
                    position: 'right',
                    formatter: function (params) {
                      // console.log(params)//这里输出params所有参数 需要什么下面自己拼
                        // return params.name + params.data;
                       return "¥" + params.data;
                    },
                    
                    textStyle: {
                        color: '#000000'
                    }
                },
                    },


                },
        //     itemStyle: {
        //        // emphasis: {
        //        //                barBorderRadius: 10
        //        //          },


        //     normal: {
        //         label : {
        //             show: true, 
        //             position: 'right',
        //             formatter: function (params) {
        //               // console.log(params)//这里输出params所有参数 需要什么下面自己拼
        //                 // return params.name + params.data;
        //                return "¥" + params.data;
        //             },
                    
        //             textStyle: {
        //                 color: '#000000'
        //             }
        //         },
        //           barBorderRadius: 10,
        //     }
        // },
            data: [63023, 63023, 63023, 63023, 63023, 63023],
        },
        {
            name: '2012年',
            type: 'bar',
            barWidth: 15,
                itemStyle: {
                    normal: {
                        barBorderRadius: 40,
                        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                            offset: 0,
                            color: '#0a6253'
                        }, {
                            offset: 1,
                            color: '#34b9a4'
                        }]),
                        // shadowColor: 'rgba(35,149,229,0.8)',
                        // shadowBlur: 20,
                        areaStyle: {type: 'default'},
                 label : {
                    show: true, 
                    position: 'right',
                    formatter: function (params) {
                      // console.log(params)//这里输出params所有参数 需要什么下面自己拼
                        // return params.name + params.data;
                       return "¥" + params.data;
                    },
                    
                    textStyle: {
                        color: '#000000'
                    }
                },
                    },


                },
        //     itemStyle: {
        //     normal: {
        //         label : {
        //             show: true, 
        //             position: 'right',
                    
        //             formatter: function (params) {
        //               // console.log(params)//这里输出params所有参数 需要什么下面自己拼
        //                 // return params.name + params.data;
        //                 return "¥" + params.data;


        //             },
                    
        //             textStyle: {
        //                 color: 'tomato'
        //             }
        //         }
        //     }
        // },




            data: [19325, 33438, 3100, 12159, 13414, 33438],
            // itemStyle : { normal: {
            //     // color: 'orange',
            //     borderRadius: 65,
            //     label : {
            //         show: true,
            //         position: 'left',
            //         formatter: '{b}'
            //     }
            // }},
                barGap:'8%'
        }
    ]
};
;
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
















       </script>
   </body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值