antvis / antvis/G2

Uncaught (in promise) TypeError: Cannot destructure property '__data__' of 'element.parentNode' as it is null

Open
#6,452 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.6k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### 问题描述

使用elementPointMove,不能移动第一个点
![1](https://github.com/user-attachments/assets/1387c72d-0487-4912-9729-47bac7e47854)
![2](https://github.com/user-attachments/assets/e8b9fb3e-8477-481b-8cc9-ed2d35fd145c)

### 重现链接

_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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.