antvis / antvis/G2Plot

🐛 [BUG] 对称条形图:当数据yField为字符串数组时,且将大的数值放入第一位,渲染后视图不正确,且图例

Open
#3,776 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
TypeScript
Stars
2.7k
Forks
591
PR merge metrics
No merged PRs in 30d

Description

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

export const data = [
{ country: '乌拉圭', '2018': 13.4, '2017': 12.3 },
{ country: '巴拉圭', '2018': 14.4, '2017': 6.3 },
{ country: '南非', '2018': 18.4, '2017': 8.3 },
{ country: '巴基斯坦', '2018': 34.4, '2017': 13.8 },
{ country: '阿根廷', '2018': 44.4, '2017': 19.5 },
{ country: '巴西', '2018': 24.4, '2017': 18.8 },
{ country: '加拿大', '2018': 54.4, '2017': 24.7 },
{ country: '中国', '2018': 104.4, '2017': 5.3 },
{ country: '美国', '2018': 165.2, '2017': 72.9 },
];

const BidirectionalBarPlot = new BidirectionalBar('container', {
data,
xField: 'country',
xAxis: {
position: 'bottom',
},
appendPadding: [0, 30],
interactions: [{ type: 'active-region' }],
yField: ['2018', '2017'],
tooltip: {
shared: true,
showMarkers: false,
},
// 开启 label 展示
label: {
// 默认居中, 'middle'
position: 'right',
// 默认为: 2
// offset: 4,
},
});

BidirectionalBarPlot.render();

bug

Contributor guide

Open the contributing guide

Research direction

Start with the BidirectionalBar configuration and reproduce the example using the provided data, xField, yField array, labels, and tooltip settings. Investigate the rendering and legend behavior when the larger value is first in the string-array yField; done means the chart view and legend render correctly for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.