echarts 带背景的二维3D柱状图

echarts 带背景的二维3D柱状图

在这里插入图片描述

var abilityuse = document.getElementById("abilityuse_echarts")
var abilityuse_echarts = echarts.init(abilityuse);
var xData = ["04-08", "04-09", "04-10", "04-11", "04-12", "04-13", "04-14"]
var line = ["375", "500", "900", "800", "610", "1001", "350"];
var line_bg = ["1500", "1500", "1500", "1500", "1500", "1500", "1500"]
var abilityuse_option = {
  title: {
    text: '(万次)',
    textStyle: {
      fontSize: 12,
      color: "#666",
      fontWeight: '400'
    },
    top: 0,
    left: "0%",
  },
  tooltip: {
    formatter: function (data) {
      let aaa = data.name + ":" + data.value + "万次"
      return aaa
    }
  },

  grid: {
    left: "4%",
    right: '1%',
    top: '11%',
    bottom: "15%"
  },
  legend: {
    show: true,
    icon: 'circle',
    orient: 'horizontal',
    top: '90.5%',
    right: 'center',
    itemWidth: 16.5,
    itemHeight: 6,
    // itemGap: 30,
    textStyle: {
      // color: '#FFFFFF'
      color: '#C9C8CD',
      fontSize: 14
    }
  },
  xAxis: [{
    data: xData,
    axisLabel: {
      show: true,
      textStyle: {
        color: '#666',
        fontSize: 12
      },
      margin: 30, //刻度标签与轴线之间的距离。
    },

    axisLine: {
      show: false //不显示x轴
    },
    axisTick: {
      show: false //不显示刻度
    },
    boundaryGap: true,
    splitLine: {
      show: false,
      width: 0.08,
      lineStyle: {
        type: "solid",
        color: "#dfdfdf"
      }
    }
  }],
  yAxis: [{
    show: true,
    splitLine: {
      show: true,
      lineStyle: {
        color: '#dfdfdf',
        type: 'solid'
      }
    },
    axisTick: {
      show: false
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#dfdfdf',
        type: 'solid'
      }
    },
    axisLabel: {
      textStyle: {
        color: '#666'
      },
    }
  }],
  series: [
    {//柱底圆片
      name: "",
      type: "pictorialBar",
      symbolSize: [32, 18],//调整截面形状
      symbolOffset: [0, 10],
      z: 12,
      itemStyle: {
        'normal': {
          color: "#4898FF",

        }
      },
      data: line_bg
    },
    //柱体
    {
      name: '',
      type: 'bar',
      barWidth: 32,
      barGap: '-100%',
      itemStyle: {
        normal: {
          color: "#4898FF",
        }
      },
      showBackground: true,
      backgroundStyle: {
        color: '#EFF8FA'
      },
      data: line
    },

    //背景柱顶圆片
    {
      name: "",
      type: "pictorialBar",
      symbolSize: [32, 18],//调整截面形状
      symbolOffset: [0, -10],
      z: 12,
      symbolPosition: "end",
      "itemStyle": {
        'normal': {
          color: '#C2E1F0',
        }
      },
      data: line_bg
    },

    //柱顶圆片
    {
      name: "",
      type: "pictorialBar",
      symbolSize: [32, 18],//调整截面形状
      symbolOffset: [0, -10],
      z: 12,
      symbolPosition: "end",
      "itemStyle": {
        'normal': {
          color: '#246FF4',
        }
      },
      data: line
    }
  ]
}
abilityuse_echarts.setOption(abilityuse_option);
window.addEventListener("resize", function () {
  abilityuse_echarts.resize()
});

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Xie_bro777

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

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

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

打赏作者

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

抵扣说明:

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

余额充值