echarts 3D柱状图

在这里插入图片描述

 arr: [60, 120, 30, 12, 50, 60, 80],


  let that = this
    var option = {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      grid: {
        top: '15%',
        left: '3%',
        bottom: '3%',
        containLabel: true
      },
      series: [{
          type: 'pictorialBar',
          name: '',
          z: 10,
          symbol: 'diamond',
          symbolOffset: [0, '-50%'],
          symbolPosition: 'end', //图形边缘与柱子结束的地方内切
          symbolSize: ['-95%', 10], //根据柱子大小来做调整
          label: { //echarts内部显示数字
            color: '#000',
            show: true,
            position: 'top',
          },
          itemStyle: {
            color: function (param) {
              let max = Math.max(...that.data.arr)
              if (param.value == max) {
                return '#FAE26A';
              } else {
                return '#6DDD80';
              }

            },
          },
          data: that.data.arr
        },
        {
          type: 'bar',
          name: 'reference bar',
          barGap: '-100%',
          // symbol: 'image://' + params.picture, // 图片自己切或者让UI设计切喔
          symbolOffset: [0, 0],
          z: 2,
          itemStyle: {
            color: function (param) {
              let max = Math.max(...that.data.arr)
              console.log(max);
              if (param.value == max) {
                // return '#FAE26A';
                return new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
                  offset: 0,
                  color: '#FED200' //指0%处的颜色
                }, {
                  offset: 0.5,
                  color: '#FED200' //指100%处的颜色
                },
                {
                  offset: 0.5,
                  color: '#CBA902'
                },
                {
                  offset: 1,
                  color: '#CBA902'
                }
                ], false)

              } else {
                return new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
                    offset: 0,
                    color: '#42C358' //指0%处的颜色
                  }, {
                    offset: 0.5,
                    color: '#42C358' //指100%处的颜色
                  },
                  {
                    offset: 0.5,
                    color: '#1FAC37'
                  },
                  {
                    offset: 1,
                    color: '#1FAC37'
                  }
                ], false)


              }

            },
          },
          data: that.data.arr
        },
        {
          type: 'pictorialBar',
          name: 'joy',
          barGap: '-100%',
          z: 3,
          symbol: 'triangle',
          symbolOffset: [0, 5],
          symbolSize: ['-100%', 5],
          symbolRotate: 180,
          itemStyle: {
            color: function (param) {
              let max = Math.max(...that.data.arr)
              console.log(max);
              if (param.value == max) {

                return new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
                  offset: 0,
                  color: '#FED200' //指0%处的颜色
                }, {
                  offset: 0.5,
                  color: '#FED200' //指100%处的颜色
                },
                {
                  offset: 0.5,
                  color: '#CBA902'
                },
                {
                  offset: 1,
                  color: '#CBA902'
                }
                ], false)

              } else {
                return new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
                    offset: 0,
                    color: '#42C358' 
                  }, {
                    offset: 0.5,
                    color: '#42C358' 
                  },
                  {
                    offset: 0.5,
                    color: '#1FAC37'
                  },
                  {
                    offset: 1,
                    color: '#1FAC37'
                  }
                ], false)
              }


            },
          },
          data:that.data.arr
        }
      ]

    };
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

看不见看不见看不见

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值