echarts机加图表实现


const labelSetting = {
  show: true,
  position: 'top',
  offset: [0, 0],
  fontSize: 12
};
const color = ['#fff','blue'];
let symbol = 'rect';
function makeOption(type) {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    grid: {
      
    },
    yAxis: {
      type: 'value',
      // inverse: true,
      splitNumber: 10,
      axisLine: { 
        show: true,
        length: 2000
        
      },
      
      splitLine:{show: false},
      axisTick: { show: false },
      axisLabel: {
        fontSize: 12,
        textStyle:{
          color: '#fff',
          fontWeight: 'bold'
        }
      },

    },
    tooltip: { show: false},
    xAxis: {
      type: 'category',
      data: ['1', '2', '3', '4', '5', '6', '7','8','9','10','11','12'],
      splitLine: { show: false },
      axisTick: { 
        show: true,
        alignWithLabel: true
      },
      axisLine: { 
        show: true,
        symbolOffset:[50,100],
      },
      axisLabel: {
        margin: '14',
        fontSize: 12,
        textStyle:{
          color: '#fff',
          fontWeight: 'bold'
        }
      },
    },
    series: [
      {
        name: '2015',
        type: 'pictorialBar',
        label: labelSetting,
        symbolRepeat: true,//使图形元素重复,即每个数据值用一组重复的图形元素表示
        symbolSize: ['150%', '40%'],//组分开表示宽和高
        barCategoryGap: '70%', //同一系列的柱间距离
        
        data: [
          {
            value: 5000,
            itemStyle: {
              color: color[0]
            },
            symbol
          },
          {
            value: 3000,
            itemStyle: {
              color: color[1]
            },
            symbol: symbol
          },
          {
            value: 2820,
            itemStyle: {
              color: color[0]
            },
            symbol: symbol 
          },
          {
            value: 4380,
            itemStyle: {
              color: color[1]
            },
            symbol: symbol
          },
          {
            value: 4080,
            itemStyle: {
              color: color[0]
            },
            symbol: symbol
          },
          {
            value: 5000,
            itemStyle: {
              color: color[1]
            },
            symbol: symbol
          },
          {
            value: 1879,
            itemStyle: {
              color: color[0]
            },
            symbol: symbol
          },
          {
            value: 3800,
            itemStyle: {
              color: color[1]
            },
            symbol: symbol
          },
          {
            value: 4500,
            itemStyle: {
              color: color[0]
            },
            symbol: symbol
          },
          {
            value: 2567,
            itemStyle: {
              color: color[1]
            },
            symbol: symbol
          },
          {
            value: 4456,
            itemStyle: {
              color: color[0]
            },
            symbol: symbol
          },
          {
            value: 3609,
            itemStyle: {
              color: color[1]
            },
            symbol: symbol
          }
        ]
      },
    ]
  };
}
const options = [
  makeOption('pictorialBar'),
];
var optionIndex = 0;
option = options[optionIndex];

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值