G2Plot icon indicating copy to clipboard operation
G2Plot copied to clipboard

🐛 [BUG]瀑布图中,xField的值为日期格式,不显示total

Open XiaJunjie2020 opened this issue 3 years ago • 3 comments

🐛 Bug description [Please make everyone to understand it]

瀑布图中,xField的值为日期格式(yyyy-MM-dd),没有显示total柱子,但留出了total的区域(空白)

image

瀑布图|G2Plot

  • Required Link to minimal reproduction:

📷 Step to reproduce

代码如下:

import { Waterfall } from '@antv/g2plot';

const data = [{
  "value": 1,
  "field": "1995-01-01"
}, 
{
  "value": 1,
  "field": "1995-01-02"
}, 
{
  "value": 1,
  "field": "1995-01-03"
},
 {
  "value": 1,
  "field": "1995-01-04"
}];

const waterfallPlot = new Waterfall('container', {
  data,
  xField: 'field',
  yField: 'value',
  total: {
    label: '合计',
    style: {
      fill: '#96a6a6',
    },
  },
});

waterfallPlot.render();

🏞 Expected result

希望能绘制出合计柱子

🚑 Any additional [like screenshots]

  • G2Plot Version:2.4.9
  • Platform:

XiaJunjie2020 avatar Mar 07 '22 09:03 XiaJunjie2020

我也遇到了相同的问题。希望能尽快修复

BBchicken-9527 avatar Mar 07 '22 09:03 BBchicken-9527

+1,希望能尽快修复呀,否则这个瀑布图不太能用。。。

tzlaosiji avatar Apr 13 '22 02:04 tzlaosiji

@tzlaosiji @BBchicken-9527 内部会自动解析x 轴数据是否是时间类型的,从而自动把 meta[xField].type 变为 timeCat。 如果x坐标数据为 time 类型, 最标轴就加不上 total 字段。 你需要把 meta[xField].type 设置为 cat 才行。

ai-qing-hai avatar Jul 12 '22 02:07 ai-qing-hai

好的,感谢

XiaJunjie2020 avatar Aug 22 '22 02:08 XiaJunjie2020