question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] ECharts.resize() ERROR! Cannot read properties of undefined (reading 'type')

See original GitHub issue

Version

5.3.1

Link to Minimal Reproduction

https://ant-colony-algorithm-function-test-3w5nc58v4-masx200.vercel.app/

Steps to Reproduce

ECharts.resize() 

https://github.com/masx200/ant-colony-algorithm-function-test/blob/7a8371201a35e66da1e9aa18da63857fe03521d6/src/appcom.ts https://github.com/masx200/ant-colony-algorithm-function-test/blob/0ae8b2ddb0c8777c8a703aa67d57742391587fed/functions/echarts-line.ts https://github.com/masx200/ant-colony-algorithm-function-test/blob/3276347cea90ac2c9535410e3c7a82328005c1a9/src/createchartofcontainer.ts https://github.com/masx200/ant-colony-algorithm-function-test/blob/3276347cea90ac2c9535410e3c7a82328005c1a9/functions/createmychart.ts https://github.com/masx200/ant-colony-algorithm-function-test/blob/3276347cea90ac2c9535410e3c7a82328005c1a9/functions/drawlinechart.ts https://github.com/masx200/ant-colony-algorithm-function-test/blob/3276347cea90ac2c9535410e3c7a82328005c1a9/src/showanddrawrandomgreedyoftsp.ts#L10

Current Behavior

node_modules/echarts/lib/processor/dataSample.js

  if (count > 10 && coordSys.type === 'cartesian2d' && sampling) {
echarts.js:976 
        
       Uncaught TypeError: Cannot read properties of undefined (reading 'type')
    at Object.reset (dataSample.js:112:34)
    at Task2.seriesTaskReset [as _reset] (Scheduler.js:485:70)
    at Task2._doReset (task.js:202:23)
    at Task2.perform (task.js:117:33)
    at Scheduler.js:272:20
    at HashMap2.each (util.js:447:20)
    at Scheduler.js:255:23
    at Array.forEach (<anonymous>)
    at each (util.js:205:13)
    at Scheduler2._performStageTasks (Scheduler.js:221:5)

Expected Behavior

no errors.

Environment

- OS:Microsoft Windows [版本 10.0.19044.1566]
- Browser:Microsoft Edge
版本 99.0.1150.30 (官方内部版本) (64 位)
- Framework:vue 3.2.31

Any additional comments?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
plainheartcommented, Mar 9, 2022

DON’T use ref or reactive to wrap the echarts instance. Use a common variable or shallowRef to avoid the deep watch for echarts instance.

2reactions
plainheartcommented, Mar 9, 2022

https://github.com/masx200/ant-colony-algorithm-function-test/blob/7a8371201a35e66da1e9aa18da63857fe03521d6/src/appcom.ts#L18-L24

I didn’t run the project code you provided, but it looks similar to those raised by other developers before. Try to remove reactive or use shallowRef.

const chartstore: {
    best: undefined | ReturnType<typeof createchartofcontainer>;
    latest: undefined | ReturnType<typeof createchartofcontainer>;
-} = reactive({
+} = {
    best: undefined,
    latest: undefined,
};
const chartstore: {
    best: undefined | ReturnType<typeof createchartofcontainer>;
    latest: undefined | ReturnType<typeof createchartofcontainer>;
-} = reactive({
+} = shallowRef({
    best: undefined,
    latest: undefined,
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Getting "TypeError Cannot read properties of ...
When I reload the app which is using the ECharts. stops at echarts.min.js line 45. gives error - "Cannot read properties of undefined...
Read more >
JQuery & Echarts: Cannot read property 'getProgressive' of ...
I encountered a strange error when using Jquery and echarts: Cannot read property 'getProgressive' of undefined. My code went like:
Read more >
vue Echarts自适应浏览器resize报错:Cannot read property ' ...
Echarts 自适应浏览器时,发现拖动窗口进行缩放时,会出现一个问题:Cannot read property 'resize' of undefined. window.EventListener('resize',function(){ myChart.resize() // 报错 ...
Read more >
error in nexttick: "typeerror: cannot read properties of ...
Getting error with vuedraggable on array of objects. View Error nextTick: TypeError: Cannot read properties of undefined (reading '__ob__').
Read more >
ngx-echarts-demo documentation
17: v7.0.0: Feat: support Angular v11, ECharts v5; Feat: support echart theme object; Perf: resize animation. 2021.01.10 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found