eCharts 横向柱状图

今天根据ui的图写了个横向柱状图

  const initOption = {
        tooltip: {
          trigger: 'item',
          axisPointer: {
            // 坐标轴指示器,坐标轴触发有效
            type: 'line' // 默认为直线,可选为:'line' | 'shadow'
          }
        },
        legend: {
          left: 'center',
          top: '5%',
          show: true,
          type: 'scroll',
          data: ['男', '女'],
          itemWidth: 12,
          itemHeight: 12,
          itemGap: 30
        },
        grid: [
          {
            show: false,
            left: '5%',
            right: '60%',
            top: 60,
            bottom: '30',
            containLabel: true
          },
          {
            show: false,
            left: '60%',
            right: '5%',
            top: 60,
            bottom: '30'
          },
          {
            show: false,
            left: '50%',
            right: '10%',
            top: 60,
            bottom: '30',
            containLabel: true
          }
        ],
        xAxis: [
          {
            type: 'value',
            gridIndex: 0,
            inverse: true,
            axisLine: {
              show: false
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              show: false
            },
            data: []
          },
          {
            type: 'value',
            gridIndex: 1,
            inverse: false,
            axisLine: {
              show: false
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              show: false
            },
            data: []
          },
          {
            type: 'value',
            gridIndex: 2,
            inverse: false,
            axisLine: {
              //只有这个
              show: false
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              show: false
            },
            data: []
          }
        ],
        yAxis: [
          {
            type: 'category',
            inverse: true,
            position: 'right',
            gridIndex: 0,
            axisLine: {
              show: false
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              show: false
            },
            data: [] // 中间的数据
          },
          {
            type: 'category',
            position: 'center',
            inverse: true,
            gridIndex: 1,
            axisLine: {
              show: false
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              show: true,
              // fontSize: 14,
              // color: '#333',
              align: 'center',
              interval: 'auto',
              margin: 40
            },
            data: []  // 中间的数据
          },
          {
            type: 'category',
            gridIndex: 2,
            inverse: true,
            position: 'left',
            axisLine: {
              show: false
            },
            splitLine: {
              show: false
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              show: false
            }
          }
        ],
        series: [
          {
            colId: 'col402utokg',
            name: '男',
            type: 'bar',
            stack: null,
            data: [],
            barWidth: 10,
            color: '#5473e8',
            xAxisIndex: 0,
            yAxisIndex: 0,
            label: {
              position: 'left',
              show: false,
              fontSize: 12,
              color: '#333'
            }
          },
          {
            colId: 'col3kkgr6h9',
            name: '女',
            type: 'bar',
            //  type: 'pictorialBar',
            //  symbol: 'images',  //可以使用自定义图片作为柱状图形
            //  symbol: 'image://' + BASE_PATH + '/pages/transportation/pages/supply/img/qianlanzz.png',
            stack: null,
            data: [],
            barWidth: 10,
            color: '#ff766f',
            xAxisIndex: 1,
            yAxisIndex: 1,
            label: {
              position: 'right',
              show: false,
              fontSize: 12,
              color: '#333'
            }
          }
        ]
      }
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值