象形柱图与柱状图组合

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body{
            background-color: #133148;
        }
    </style>
</head>
<body>
    <div id="main" style="width: 1000px;height:600px;">

    </div>
</body>
<script src="echarts.js"></script>
<script>
    var myChart = echarts.init(document.getElementById('main'));  
    var categoryArry = ['A','B','C','D','E']; 
    var arry = [9481,5000,475,399,1475];
    var max = 1.6*Math.max.apply(null,arry);
    var fzArry = [max,max,max,max,max];
    option = {
        // tooltip: {
        //     trigger: 'axis',
        //     axisPointer: {
        //         type: 'shadow'
        //     }
        // },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '1%',
            top: '1%',
            containLabel: true
        },
        xAxis: {
            // max: 300,
            splitLine: {
              show: false
            },
            axisLine: {
              show: false
            },
            axisLabel: {
              show: false
            },
            axisTick: {
              show: false
            }
        },
        yAxis: [{
            type: 'category',
            inverse: false,
            data: categoryArry,
            axisLabel: { //坐标轴刻度标签的相关设置
                color: "#7eb2d5",
                fontSize:16
            },
            axisLine: {
              show: false
            },
            axisTick: {
              show: false
            }
        }],
        series: [
            {
                name: '客户端用户总量',
                type: 'pictorialBar',
                // barWidth: 100,
                symbol: 'rect',
                symbolSize: ['20%',20],
                symbolPosition: 'start',
                symbolOffset: [5,0],//偏移量
                // symbolMargin: '20!',
                symbolRepeat: true,
                // barCategoryGap: 22,
                // symbolBoundingData: 700000,
                label: {
                    normal: {
                        show: true,
                        position: 'left',//标签的位置
                        distance: -750,
                        color: '#1df1f9',
                        fontSize: 16,
                        fontFamily: 'Quartz Regular',
                        // formatter: '{c}'
                        formatter: function(params){
                            return toThousandsForChart(params);
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: '#45A0CF',
                        // borderColor: '#45A0CF'
                    }
                },
                // z: 20,
                data: arry
            },
            {
                name: '辅助系列',
                type: 'bar',
                barWidth: 30,
                barCategoryGap: '10%', //22,
                data: fzArry,
                itemStyle: {
                    normal: {
                        color: 'rgba(255,255,255,0.1)',
                        borderColor: '#09687e',//['#09687e','#f19802','#09687e','#09687e','#09687e'],
                        borderWidth: 3,
                        barBorderRadius: [0, 20, 20, 0]
                    }
                },
                z: 9
            },

        ]
    };
    myChart.setOption(option); 
    // 
    function toThousandsForChart(params){
        var num = (params.value || params || 0).toString(), result = '';
        while (num.length > 3) {
            result = ',' + num.slice(-3) + result;
            num = num.slice(0, num.length - 3);
        }
        if (num) { result = num + result; }
        return result;
    }
</script>
</html>

这里写图片描述

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值