柱状图配置项例子

这个柱状图官方示例里面一大堆,主要拿出来看一下各个组件的配置

配置项:

option = {
  title: {
    text: 'test',
    textStyle: {
      fontSize: 12,
      color: '#666'
    },
    // title 的位置    
    left: 25,
    top: 20
  },
  xAxis: {
    type: 'category',
    data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', 
'9月', '10月', '11月', '12月'],
    // 坐标轴刻度相关设置
    axisTick: {
      // 类目轴中在 boundaryGap 为 true 的时候有效,可以保证刻度线和标签对齐
      alignWithLabel: true,
      // 刻度线的样式设置
      lineStyle: {
        color: '#999'
      }
    },
    // 坐标轴轴线相关设置
    axisLine: {
      // 坐标轴轴线的样式设置
      lineStyle: {
        color: '#999'
      }
    },
    // 坐标轴刻度标签的相关设置(如刻度下面的月份就是label)
    axisLabel: {
      color: '#333'
    }
  },
  yAxis: {
    axisLine: {
      show: false
    },
    axisTick: {
      show: false
    },
    // 坐标轴在 grid 区域中的分隔线
    splitLine: {
      // 分割线样式
      lineStyle: {
        type: 'dotted',
        color: '#eee'
      }
    }
  },
  series: [{
    type: 'bar',
    barWidth: '35%',
    data: [320, 82, 200, 334, 390, 330, 410, 82, 200, 334, 390, 330]
  }],
  color: ['#3398DB'],
  grid: {
    top: 50,
    left: 60,
    right: 60,
    bottom: 20
  }
}

效果图:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值