apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.69k stars 19.62k forks source link

[Bug] Uncaught TypeError: Cannot read properties of undefined (reading 'type') #20474

Closed ZBeanDan closed 2 weeks ago

ZBeanDan commented 2 weeks ago

Version

"echarts": "^5.5.0",

Link to Minimal Reproduction

const option = { title: { text: props.title, left: 'center', bottom: 20 }, tooltip: { trigger: 'item' }, xAxis: { type: 'category', data: props.data?.xaxis }, yAxis: { type: 'value' }, legend: { left: 'center', textStyle: { color: '#000' }, data: props.data?.legend?.slice(0, 4) }, grid: { left: '4%', // 调整左侧距离 containLabel: true // grid 区域是否包含坐标轴的刻度标签 }, series: props.data?.lineData?.slice(0, 4) };

Steps to Reproduce

image image

点击legend配置的标题时,浏览器控制台提示如上错误

Current Behavior

Uncaught TypeError: Cannot read properties of undefined (reading 'type') at LineView2.render (echarts.js?v=1c336748:33743:38) at Task2.progress (echarts.js?v=1c336748:20328:20) at Task2._doProgress (echarts.js?v=1c336748:17963:12) at Task2.perform (echarts.js?v=1c336748:17942:18) at echarts.js?v=1c336748:24024:26 at GlobalModel2. (echarts.js?v=1c336748:16359:12) at Array.forEach () at each (echarts.js?v=1c336748:425:9) at GlobalModel2.eachSeries (echarts.js?v=1c336748:16357:7) at renderSeries (echarts.js?v=1c336748:24015:17)

Expected Behavior

正常展示,点击时不报错

Environment

- OS:Mac Pro
- Browser:Chrome 130.0.6723.92
- Framework:vue3

Any additional comments?

No response

echarts-bot[bot] commented 2 weeks ago

@ZBeanDan It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED
**BODY** ### Version "echarts": "^5.5.0", ### Link to Minimal Reproduction const option = { title: { text: props.title, left: 'center', bottom: 20 }, tooltip: { trigger: 'item' }, xAxis: { type: 'category', data: props.data?. xaxis }, yAxis: { type: 'value' }, legend: { left: 'center', textStyle: { color: '#000' }, data: props.data?.legend?.slice(0, 4) } , grid: { left: '4%', // Adjust the left distance containLabel: true // Whether the grid area contains the scale label of the coordinate axis}, series: props.data?.lineData?.slice(0, 4) } ; ### Steps to Reproduce ![image](https://github.com/user-attachments/assets/ac62d170-12ca-418c-be6d-e26a8b134ca1) ![image](https://github.com/user-attachments/assets/6e97a8a5-2a17-48af-97c9-fe7b9263f0a6) When clicking the title of the legend configuration, the browser console prompts the above error ### Current Behavior Uncaught TypeError: Cannot read properties of undefined (reading 'type') at LineView2.render (echarts.js?v=1c336748:33743:38) at Task2.progress (echarts.js?v=1c336748:20328:20) at Task2._doProgress (echarts.js?v=1c336748:17963:12) at Task2.perform (echarts.js?v=1c336748:17942:18) at echarts.js?v=1c336748:24024:26 at GlobalModel2. (echarts.js?v=1c336748:16359:12) at Array.forEach () at each (echarts.js?v=1c336748:425:9) at GlobalModel2.eachSeries (echarts.js?v=1c336748:16357:7) at renderSeries (echarts.js?v=1c336748:24015:17) ### Expected Behavior Display normally, no error reported when clicked ### Environment ```markdown -OS:Mac Pro - Browser:Chrome 130.0.6723.92 - Framework:vue3 ``` ### Any additional comments? _No response_
ZBeanDan commented 2 weeks ago

已解决