antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.12k stars 1.59k forks source link

[4.0] bug & 优化汇总 #1715

Closed hustcc closed 4 years ago

hustcc commented 4 years ago

常驻、置顶,直到全部修复。所有 bugfix 的 pr ref 到这个 issue。

JasonWong-ZS commented 4 years ago

饼图数据传入为数值的时候,其中一个数值为负数的问题

const data = [ { item: '事例一', percent: -0.4 }, { item: '事例二', percent: 0.21 }, { item: '事例三', percent: 0.17 }, { item: '事例四', percent: 0.13 }, { item: '事例五', percent: 0.09 } ]; const chart = new G2.Chart({ container: 'container', forceFit: true, height: 500 }); chart.source(data, { percent: { formatter: val => { //val = (val 100) + '%'; return val; } } }); chart.coord('theta', { radius: 0.75 }); chart.tooltip({ showTitle: false, itemTpl: '

  • {name}: {value}
  • ' }); chart.intervalStack() .position('percent') .color('item') .label('percent', { formatter: (val, item) => { return item.point.item + ': ' + val; } }) .tooltip('itempercent', (item, percent) => { percent = percent * 100 + '%'; return { name: item, value: percent }; }) .style({ lineWidth: 1, stroke: '#fff' }); chart.render();

    image

    simaQ commented 4 years ago

    axis line 和 grid 重叠的问题

    这个应该是可以通过绘制顺序解决,把 grid 绘制在 backgroundGroup 层,坐标轴线绘制在 frontGroup 层

    simaQ commented 4 years ago

    image

    simaQ commented 4 years ago

    如下图。右侧 padding 为 0,鼠标离开的时候没有触发 plot:leave 事件,导致 tooltip 没有隐藏 image

    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago

    只要用户定义了 items ,就以用户定义的 items 为准

    simaQ commented 4 years ago

    image

    simaQ commented 4 years ago

    下面重复

    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago

    复现 demo: http://localhost:8000/zh/examples/bar/basic#time-bar

    image

    simaQ commented 4 years ago

    image

    const data = [
          { country: '巴西', population: 18203 },
          { country: '印尼', population: 23489 },
          { country: '美国', population: 29034 },
          { country: '印度', population: 104970 },
          { country: '中国', population: 131744 },
        ];
    
        const div = createDiv();
        div.style.display = 'inline-block';
        const chart = new G2.Chart({
          container: createDiv(),
          width: 250,
          height: 200,
        });
    
        chart.data(data);
    
        chart.coordinate().transpose();
        // chart.coordinate('polar').transpose();
        chart.interval().position('country*population');
    
        chart.render();
    simaQ commented 4 years ago
    return ['image', imageMap[name]];
    simaQ commented 4 years ago

    image

    image

    simaQ commented 4 years ago
    simaQ commented 4 years ago

    Scale 相关问题

    @dxq613 @zqlu

    log scale 导致的

    chart.scale('exp_amo', {
      type: 'log',
      ticks: [225, 1000000, 2000000, 4000000, 6000000]
    });
    simaQ commented 4 years ago
    simaQ commented 4 years ago
    chart.axis('day', {
      title: null,
      grid: {
        align: 'center',
        lineStyle: {
          lineWidth: 1,
          lineDash: null,
          stroke: '#f0f0f0'
        },
        showFirstLine: true
      }
    });
    paleface001 commented 4 years ago
    • [ ] gird 是否支持 align: 'center' ?
    chart.axis('day', {
      title: null,
      grid: {
        align: 'center',
        lineStyle: {
          lineWidth: 1,
          lineDash: null,
          stroke: '#f0f0f0'
        },
        showFirstLine: true
      }
    });

    还是要支持滴~ 色块图用的着

    simaQ commented 4 years ago

    G2 层处理

    chart.legend({
      reversed: boolean,
    });
    simaQ commented 4 years ago
    lessmost commented 4 years ago
    • [ ] slider 组件 @zqlu

    @hustcc @dxq613 https://github.com/antvis/scale/pull/23 https://github.com/antvis/component/pull/118

    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago

    12.30 beta 发布后添加 https://github.com/antvis/G2/projects/2#card-30956256

    simaQ commented 4 years ago

    参考 https://yuque.antfin-inc.com/antv/g2-4/dlzf45#7e22ccf3

    simaQ commented 4 years ago
    dxq613 commented 4 years ago
    simaQ commented 4 years ago

    image

    simaQ commented 4 years ago
    simaQ commented 4 years ago

    原因: 图例没有按照传入的 maxWidth 进行布局导致的。

     chart.legend(false);

    即可绘制正确。

    image

    @dxq613

    simaQ commented 4 years ago

    image

    simaQ commented 4 years ago
    simaQ commented 4 years ago

    image

    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago
    simaQ commented 4 years ago

    定位到是由 clone() 函数导致

    simaQ commented 4 years ago

    原因:userData 数据源中有一个字段是 valsue,导致 size('value') 映射时,该条数据对应的点的 r 为 NaN,然后导致 bbox 为 NaN,最后导致局部刷新出错~~~ ref https://github.com/antvis/g/issues/343

    dxq613 commented 4 years ago
    simaQ commented 4 years ago

    image

    http://localhost:8000/zh/examples/heatmap/heatmap#calendar-horizontal

    simaQ commented 4 years ago

    http://localhost:8000/zh/examples/funnel/funnel#basic

    image

    simaQ commented 4 years ago

    http://localhost:8000/zh/examples/map/map#bubble-map image

    simaQ commented 4 years ago

    http://localhost:8000/zh/examples/map/map#choropleth-map

    image

    https://github.com/antvis/G2/issues/1715#issuecomment-569633373 同一个问题,先关闭

    simaQ commented 4 years ago

    http://localhost:8000/zh/examples/map/map#us-states-hex

    image

    image

    simaQ commented 4 years ago

    主要原因:4.0 的 scale 不支持 timeCat 导致的

    simaQ commented 4 years ago

    http://localhost:8000/zh/examples/box/box#radial-box

    image