echarts 立体柱状图

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./echarts.js"></script>
    <style>
        #main {
            width: 924px;
            height: 370px;
            background-color: #0d1934;
        }
    </style>
</head>

<body>
    <div id="main"></div>
</body>
<script>
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;

    option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: {
            y: '10',
            textStyle: {
                color: 'white'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            splitLine: {
                //柱状图默认xAxis(false)
                show: true,
                lineStyle: {
                    color: 'rgba(0,0,0,0)',
                }
            },
            data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
        },
        yAxis: {
            type: 'value',
            splitLine: {
                //柱状图默认xAxis(false)
                show: true,
                lineStyle: {
                    color: 'rgba(0,0,0,0)',
                }
            },
            boundaryGap: [0, 0.01]
        },
        series: [{
            name: "上线数",
            type: "bar",
            barWidth: 24,
            barCategoryGap: 12,
            data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
            label: {
                show: true,
                position: 'top',
                color: 'white'
            },
            itemStyle: {
                // 柱体渐变色
                color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                    offset: 0,
                    color: "rgba(0, 245, 255, 0.3) ",
                }, {
                    offset: 0.5,
                    color: "#02f7f5",
                }, {
                    offset: 1,
                    color: "rgba(0, 245, 255, 0.3)",
                }, ]),
            },
        }, {
            //上
            name: "上线数",
            type: "pictorialBar",
            symbolSize: [24, 6],
            symbolOffset: [-14, -3],
            z: 12,
            itemStyle: {
                color: "#02f7f5"
            },
            symbolPosition: "end",
            data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
        }, {
            // 柱状
            name: "入库数",
            type: "bar",
            barWidth: 24,
            barCategoryGap: 10,
            data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
            label: {
                show: true,
                position: 'top',
                color: 'white'
            },
            itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                    offset: 0,
                    color: "rgba(2, 153, 248, 0.3)",
                }, {
                    offset: 0.5,
                    color: "rgba(2, 153, 248, 1)",
                }, {
                    offset: 1,
                    color: "rgba(2, 153, 248, 0.3)",
                }, ]),
            },
        }, {
            // 上
            name: "入库数",
            type: "pictorialBar",
            symbolSize: [24, 6],
            symbolOffset: [14, -3],
            z: 12,
            itemStyle: {
                color: "rgba(2, 153, 248, 1)"
            },
            symbolPosition: "end",
            data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
        }],
    };

    option && myChart.setOption(option);
</script>

</html>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值