立体3D渐变的echarts柱状图

立体3D渐变的echarts柱状图

一、原理

立体柱图效果是由四部分组成,上下左右,渐变效果可以删除底部

二 、效果

立体3D渐变的echarts效果图

效果

三、代码

option = {
  tooltip: {
    trigger: 'item'
  },
  grid: {
    top: '15%',
    left: '8%',
    right: '12%',
    bottom: '15%',
    containLabel: true
  },
  xAxis: {
    data: [1,2,3],
    splitLine: {
      show: false
    },
    axisTick: {
      show: false
    },
    axisLine: {
      symbol: ['none'],
      symbolSize: [10, 17],
      lineStyle: {
        color: '#FFF',
        width: 0 //  改变坐标线的颜色
      }
    },
    offset: 8,
    axisLabel: {
      //调整x轴的lable
      textStyle: {
        fontSize: 11, // 让字体变大
        fontFamily: 'MicrosoftYaHei-Bold, MicrosoftYaHei',
        fontWeight: 'bold',
        color: '#FFFFFF'
      }
    }
  },
  yAxis: {
    // type: "value",
    // name:'时长(小时)',
    splitLine: {
      //刻度线
      show: false
    },
    splitArea: {
      //柱状图后面的背景色
      show: false
      // areaStyle: {
      //   color: ["rgba(221,247,250,0.7)","rgba(245,249,232,0.7)"]
      // }
    },
    axisTick: {
      show: false
    },
    axisLabel: {
      //调整y轴的lable
      textStyle: {
        fontSize: 12 // 让字体变大
      },
      show: false
    },
    axisLine: {
      symbol: ['none'],
      symbolSize: [15, 17],
      lineStyle: {
        color: 'rgba(0 0 0 0)',
        width: 0 //  改变坐标线的颜色
      }
    }
  },
  axisPointer: {
    show: false,
    link: { xAxisIndex: 'all' },
    type: 'shadow',
    label: {
      backgroundColor: '#777'
    }
  },
  series: [
    {
      name: '',
      type: 'bar',
      showSymbol: false,
      hoverAnimation: false,
      data: [1,2,3,4],
      barWidth: 10, //柱图宽度
      // barCategoryGap:'60%',
      itemStyle: {
        //左面
        normal: {
          color: function (params) {
            let colorList = ['#7EEEFB'];
            return colorList[0];
          },
          barBorderRadius: [4, 0, 0, 100]
        }
      }
    },
    {
      name: '',
      tooltip: {
        show: true
      },
      type: 'bar',
      barWidth: 10,
      // barCategoryGap:'60%',
      itemStyle: {
        //右面
        normal: {
          color: function (params) {
            let colorList = ['#48D9F5'];
            return colorList[0];
          },
          borderWidth: 0.1,
          barBorderRadius: [0, 5, 100, 0]
        }
      },
      data: [1,2,3,4],
      barGap: 0
    },
    {
      name: '',
      tooltip: {
        show: false
      },
      type: 'pictorialBar',
      itemStyle: {
        //顶部
        normal: {
          color: function (params) {
            let colorList = ['#48D9F5'];
            return colorList[0];
          },
          borderColor: '#000',
          borderWidth: 0.1,
          label: {
            show: true, //开启显示
            position: 'top', //在上方显示
            textStyle: {
              //数值样式
              color: '#FFFFFF',
              fontSize: 14,
              fontFamily: '微软雅黑'
            },
            offset: [0, -2]
          }
        }
      },
      symbol: 'diamond',
      symbolSize: ['20.5', '13'],
      symbolOffset: [0, '-38%'],
      symbolPosition: 'end',
      data: [1,2,3,4],
      z: 3
    },
    {
      name: '',
      tooltip: {
        show: false
      },
      type: 'pictorialBar',
      itemStyle: {
        //底部
        normal: {
          color: function (params) {
            let colorList = ['#48D9F5'];
            return colorList[0];
          },
          borderColor: '#000',
          borderWidth: 0.1,
          label: {
            show: false, //开启显示
            position: 'top', //在上方显示
            textStyle: {
              //数值样式
              color: '#FFFFFF',
              fontSize: 14,
              fontFamily: '微软雅黑'
            },
            offset: [0, -2]
          }
        }
      },
      symbol: 'diamond',
      symbolSize: ['20.5', '17'],
      symbolOffset: [0, '2.5'],
      symbolPosition: 'start',
      data: [1,2,3,4],
      z: 0
    }
  ]
};
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值