echarts 三角形柱状图

本文介绍了一个使用ECharts库创建的柱状图,展示了运维一部到四部的人员统计数据,通过pictorialBar类型呈现,详细配置了颜色渐变和轴标签等样式。
摘要由CSDN通过智能技术生成
标题

            var xdata = ['运维一部', '运维二部', '运维三部', '运维四部']
            var data = [150, 120, 130, 145]
            const options = {
                tooltip: {
                    trigger: 'axis',
                    borderRadius: 5,
                    borderColor: '#fff',
                    borderWidth: 1,
                    formatter: function (params) {
                        // 滑动每一条数据对应的数据 params
                        return params[0].axisValue + '<br>' + '人员统计 :' + params[0].value
                    },
                    textStyle: {
                        fontSize: 30//设置文字大小为14像素
                    }
                },
                grid: {
                    left: 40,
                    right: '3%',
                    bottom: 20,
                    top: '15%',
                    containLabel: true
                },
                xAxis: {
                    data: xdata,
                    triggerEvent: true,
                    axisTick: {
                        // 刻度线
                        show: false
                    },
                    axisLine: {
                        show: false
                    },
                    axisLabel: {
                        show: true,
                        rotate: 0,
                        interval: 0,
                        textStyle: {
                            color: '#A3D2FE',
                            fontSize: 28,
                            padding: [16, 0, 0, 0]
                        }
                    }
                },
                yAxis: {
                    triggerEvent: true,
                    splitLine: {
                        show: true,
                        lineStyle: {
                            type: 'dashed', // 虚线
                            color: '#5EADFF'
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    axisLine: {
                        show: false
                    },
                    axisLabel: {
                        // y轴线
                        show: true,
                        textStyle: {
                            color: '#A3D2FE',
                            fontSize: 28
                        }
                    }
                },
                series: [
                    {
                        name: 'hill',
                        barMinHeight: 10,
                        type: 'pictorialBar',
                        barCategoryGap: '60%',
                        symbol:
                            'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
                        itemStyle: {
                            normal: {
                                // 渐变色
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                    {
                                        offset: 0,
                                        color: '#D0ECFF'
                                    },
                                    {
                                        offset: 0.5,
                                        color: '#64C2FF'
                                    },
                                    {
                                        offset: 1,
                                        color: '#007DD4'
                                    }
                                ])
                            }
                        },
                        data: data,
                        z: 10
                    }
                ]
            }
          

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值