echarts: Cannot stack bars on time x-axis

One-line summary [问题简述]

Stacked bar charts collapsed since 4.0.3. See screenshot.

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.0.4
  • Browser version [浏览器类型和版本]: Chrome 64
  • OS Version [操作系统类型和版本]: macOS High Sierra

Expected behaviour [期望结果]

Bars able to stack on top of each other without overflowing issues.

ECharts option [ECharts配置项]

option = { 
  grid: {
    right: '8%',
    left: '8%'
  },
  xAxis: {
      type: 'time',
      minInterval: 1000 * 3600 * 24
  },
  yAxis: {
    type: 'value',
    min: 0,
    max: 100,
    name: '%'
  },
  series: [
  {
    type: 'bar',
    stack: 'adherence',
   data: [{
       value: ['2018-02-21', 6, 2, 33, 67]
     }],
    encode: { x: 0, y: 3 },
    barMaxWidth: 25,
    barCategoryGap: '50%',
    cursor: 'auto',
    itemStyle: {
      normal: {
        color: 'red',
        opacity: 0.5
      }
    }
  },
  {
    type: 'bar',
    stack: 'adherence',
    data: [{
       value: ['2018-02-21', 6, 2, 33, 67]
     }],
    encode: { x: 0, y: 4 },
    barMaxWidth: 25,
    barCategoryGap: '50%',
    cursor: 'auto',
    itemStyle: {
      normal: {
        color: 'green',
        opacity: 0.5
      }
    }
  }],
  dataZoom: {
    type: 'slider',
    showDataShadow: false
  }
}

Other comments [其他信息]

screen shot 2018-03-14 at 14 44 01

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 12
  • Comments: 19 (3 by maintainers)

Most upvoted comments

+1, we need stacking with x-axis type value

Has something changed that makes this slightly more supported now or are there still limitations on stacking on a time axis? When I try the options provided by the original poster, it looks like it might be properly stacked now.

image

Same issue here, I use echarts to visualize memory consumption over time and I stack the memory usages to display the repartition of the overall memory usage. eg: heap memory + off-heap memory = total memory consumed, thus I want to stack series as in the following plot: image

I have the same problem, stacked bar chart with time x-axis worked in 4.0.2 but not until 4.0.3.

Switching x-axis type to ‘category’ solved the problem. But unsure why issue only arose after version upgrade from 4.0.2 to 4.0.4.