echarts实现3D柱状图

Echarts实现3D柱状图


<!DOCTYPE html>
<html style="height: 100%">

<head>
    <meta charset="utf-8">
    <title>柱状图</title>
</head>

<body style="height: 100%; margin: 0">
    <div id="container" style="height: 100%"></div>
    <script type="text/javascript" src="echarts.min.js"></script>
    <script type="text/javascript">
        let dom = document.getElementById("container");
        let myChart = echarts.init(dom);
        let dataX = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
        let data = [220, 182, 191, 234, 290, 330, 360];
        option = {
            grid: {
                containLabel: true,
                left: '10%',
                top: "9%",
                bottom: "10%",
            },
            xAxis: {
                data: dataX
            },
            yAxis: {},
            grid: {
                bottom: "10%"
            },
            series: [{
                type: 'bar',
                barWidth: 17,
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = ['#0bebf9', '#07bcf8', '#f488f2', '#fcf367', '#fcf912', '#fa14c6', '#184dfa'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[params.dataIndex]
                        },
                        barBorderRadius: [0, 0, 0, 0]
                    }
                },
                data: data
            }, {
                name: 'a',
                tooltip: {
                    show: false
                },
                type: 'bar',
                barWidth: 17,
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = ['#0bebf9', '#07bcf8', '#f488f2', '#fcf367', '#fcf912', '#fa14c6', '#184dfa'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[params.dataIndex]
                        },
                        barBorderRadius: [0, 0, 0, 0]
                    }
                },
                data: data,
                barGap: 0
            }, {
                name: 'b',
                tooltip: {
                    show: false
                },
                type: 'pictorialBar',
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = ['#0bebf9', '#07bcf8', '#f488f2', '#fcf367', '#fcf912', '#fa14c6', '#184dfa'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[params.dataIndex]
                        },
                        borderWidth: 1,
                        borderColor: '#fff',
                        label: {
                            show: true,
                            position: 'top',
                        }
                    }
                },
                symbol: 'rect',
                symbolRotate: 45,
                symbolSize: ['24', '24'],
                symbolOffset: ['0', '-11'],
                symbolPosition: 'end',
                data: data,
                z: 3
            }, {
                name: 'c',
                tooltip: {
                    show: false
                },
                type: 'pictorialBar',
                itemStyle: {
                    normal: {
                        color: function (params) {
                            var colorList = ['#0bebf9', '#07bcf8', '#f488f2', '#fcf367', '#fcf912', '#fa14c6', '#184dfa'];
                            if (params.dataIndex >= colorList.length) {
                                index = params.dataIndex - colorList.length;
                            }
                            return colorList[params.dataIndex]
                        },
                        borderWidth: 1,
                        borderColor: '#fff',
                    }
                },
                symbol: 'rect',
                symbolRotate: 45,
                symbolSize: ['24', '24'],
                symbolOffset: ['0', '11'],
                symbolPosition: 'start',
                data: data,
                z: 3
            }]
        };
        myChart.setOption(option);
    </script>
</body>

</html>

本人echarts小白,柱状图底部盖住了x轴,一直没有找到办法解决,希望大神可以指导

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值