antvis / antvis/G2Plot

🐛 [BUG] 对称条形图在渲染时传入空数组,表格线条显示不正确

Open
#3,440 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 = [ ];
export const data2 = [
{ country: '乌拉圭', '2016年耕地总面积': 13.4, '2016年转基因种植面积': 12.3 },
{ country: '巴拉圭', '2016年耕地总面积': 14.4, '2016年转基因种植面积': 6.3 },
{ country: '南非', '2016年耕地总面积': 18.4, '2016年转基因种植面积': 8.3 },
{ country: '巴基斯坦', '2016年耕地总面积': 34.4, '2016年转基因种植面积': 13.8 },
{ country: '阿根廷', '2016年耕地总面积': 44.4, '2016年转基因种植面积': 19.5 },
{ country: '巴西', '2016年耕地总面积': 24.4, '2016年转基因种植面积': 18.8 },
{ country: '加拿大', '2016年耕地总面积': 54.4, '2016年转基因种植面积': 24.7 },
{ country: '中国', '2016年耕地总面积': 104.4, '2016年转基因种植面积': 5.3 },
{ country: '美国', '2016年耕地总面积': 165.2, '2016年转基因种植面积': 72.9 },]
const BidirectionalBarPlot = new BidirectionalBar('container', {
data,
xField: 'country',
xAxis: {
position: 'bottom',
grid: {
line: {
style: {
stroke: "rgba(0,0,0,0.7",
lineWidth: 19,
cursor: "pointer",
},
},
},
},
interactions: [{ type: 'active-region' }],
yField: ['2016年耕地总面积', '2016年转基因种植面积'],
tooltip: {
shared: true,
showMarkers: false,
},
});

BidirectionalBarPlot.render();

BidirectionalBarPlot.changeData(data2)
image

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue from the BidirectionalBar example using an empty initial data array, the configured xAxis grid, and changeData(data2). Start by tracing the BidirectionalBar rendering and data-change path that updates the grid. Done means the grid lines render correctly after the chart changes from empty data to data2.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.