echarts柱状图怎么做到这样?

img

echarts怎么做到这种图 官网也没找到类似于这种demo有没有大Lao帮忙解答一下

你要活用啊,首先柱状图之间的间距将其设置为0。单个柱状图的实现你可以看做堆叠柱状图,顶部和底部的数据写死,之后就是自定义tooltip(formatter)。算了,帮你弄一下

img


option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      // Use axis to trigger tooltip
      type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
    }
  },
  legend: {},
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: {
    type: 'value'
  },
  yAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  series: [
    {
      name: 'Direct',
      type: 'bar',
      stack: 'total',
      barCategoryGap: 0,
      data: [5, 5, 5, 5, 5, 5, 5]
    },
    {
      name: 'Mail Ad',
      type: 'bar',
      stack: 'total',
      barCategoryGap: 0,
      data: [120, 132, 101, 134, 90, 230, 210]
    },
    {
      name: 'Search Engine',
      type: 'bar',
      stack: 'total',
      barCategoryGap: 0,
      data: [5, 5, 5, 5, 5, 5, 5]
    }
  ]
};