antvis / antvis/F2

滚动条+ 动态请求数据渲染问题

Open
#1,539 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8k
Forks
637
PR merge metrics
No merged PRs in 30d

Description

如果从接口请求数据,然后再渲染图标,只有滚动条可以滚动,数据不同步更新,只会全部渲染;
如果直接使用静态数据,滚动条可以滚动,数据也可以同时滚动
```

//组件
const Testline = (props: { data: any[] }) => {
return (






{/* */}

);
};

数据传入

·····

//方式一
const [Data, setData] = React.useState([
{
date: "2017-11-01",
steps: 30529,
first: true,
},
{
date: "2017-11-02",
steps: 30193,
},
{
date: "2017-11-03",
steps: 20919,
},
{
date: "2017-11-04",
steps: 25413,
},
{
date: "2017-11-05",
steps: 28461,
},
{
date: "2017-11-06",
steps: 22920,
},
{
date: "2017-11-07",
steps: 33865,
},
{
date: "2017-11-08",
steps: 19357,
},
{
date: "2017-11-09",
steps: 16825,
},
{
date: "2017-11-10",
steps: 12516,
},
{
date: "2017-11-11",
steps: 31490,
},
{
date: "2017-11-12",
steps: 2426,
},
{
date: "2017-11-13",
steps: 29789,
},
{
date: "2017-11-14",
steps: 19578,
},
{
date: "2017-11-15",
steps: 28381,
},
{
date: "2017-11-16",
steps: 24357,
},
{
date: "2017-11-17",
steps: 22865,
},
{
date: "2017-11-18",
steps: 885,
},
{
date: "2017-11-19",
steps: 14907,
},
{
date: "2017-11-20",
steps: 11647,
},
{
date: "2017-11-21",
steps: 12275,
},
{
date: "2017-11-22",
steps: 4747,
},
{
date: "2017-11-23",
steps: 11647,
},
{
date: "2017-11-24",
steps: 4926,
},
{
date: "2017-11-25",
steps: 4939,
},
{
date: "2017-11-26",
steps: 1005,
},
{
date: "2017-11-27",
steps: 6569,
},
]);

//方式2
const [Data2, setData2] = React.useState([]);

React.useEffect(() => {
fetch("https://gw.alipayobjects.com/os/antfincdn/ZpWsTPpY6%26/steps.json")
.then((res) => res.json())
.then((data) => {
setData2(data);
});
},[])

return <>
//静态
//动态数据

····

```

F2版本:4.0.25
F2-React 版本:4.0.25

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown Testline component and the two data sources in F2/F2-React 4.0.25, comparing static state data with the fetch result. Inspect the ReactCanvas, Chart, and ScrollBar interaction first; done means asynchronously loaded data renders incrementally and stays synchronized with horizontal scrolling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.