Uncaught (in promise) TypeError: Cannot destructure property '__data__' of 'element.parentNode' as it is null
- Dominant language
- TypeScript
- Stars
- 12.6k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### 问题描述
使用elementPointMove,不能移动第一个点


### 重现链接
_No response_
### 重现步骤
import { onMounted, ref } from 'vue';
import { Chart } from '@antv/g2';
const c = ref(null)
const data = [
{
x: 11,
y: 6715,
},
{
x: 12,
y: 6069.88272,
},
{
x: 13,
y: 4858.33165,
},
{
x: 14,
y: 3833,
},
{
x: 15,
y: 2399,
},
{
x: 16,
y: 1613,
},
{
x: 17,
y: 1132,
},
{
x: 18,
y: 809.8,
},
{
x: 19,
y: 579.4,
},
{
x: 20,
y: 416.4,
},
{
x: 21,
y: 302.4,
},
{
x: '22',
y: 219.5,
},
{
x: 23,
y: 152.9,
},
]
onMounted(() => {
const chart = new Chart({
container: c.value,
autoFit: true,
});
chart
.line()
.data(data)
.interaction({elementPointMove: true })
.encode('x', 'x')
.encode('y', 'y')
chart.on('afterrender', () => {
chart.emit('element-point:select', {
data: { selection: [0], },
});
});
chart.render().then(() => {
chart.on('element-point:select', (v) => {
const { data: { selection }, } = v;
console.log(selection, 'selection');
});
chart.on('element-point:moved', (v) => {
const { data: { changeData, data }, } = v;
console.log(changeData, 'changeData');
console.log(data, 'data');
});
});
})
### 预期行为
我期望 能正常移动第一个点不会报错
### 平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
### 屏幕截图或视频(可选)
_No response_
### 补充说明(可选)
_No response_
Contributor guide
Research direction
Start with the elementPointMove interaction entry point and reproduce the supplied Vue/Chart example, focusing on selecting and moving the first point. Done means the first point moves without the reported TypeError and the supplied selection and moved event handlers receive their data.
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