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.

Cannot read property 'getRawIndex' of undefined

See original GitHub issue

One-line summary [问题简述]

饼图未完全渲染,即饼图动态变化时,鼠标hover到饼图的扇区,报错Cannot read property ‘getRawIndex’ of undefined, 但不影响渲染以及后续使用

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.1.0
  • Browser version [浏览器类型和版本]: 70.0.3538.77
  • OS Version [操作系统类型和版本]: mac

Expected behaviour [期望结果]

不输出该错误

ECharts option [ECharts配置项]

option = {
   tooltip: {
      show: true,
      formatter: (params) => {....},
  }
  series: [{
     name: '计数',
      type: 'pie',
      center: ['50%', '50%'],
      data: [{
       .......
       }]
   }]
  }
}

比较特殊的是 我的数据是远程获取,并且数据比较大,当整个饼图渲染完,并没有变化的时候,鼠标hover上去不会有什么错误,但是当数据还在加载的时候,饼图还在变化,这个时候鼠标hover上去会报错。 错误如下

Other comments [其他信息]

dataFormat.js?6c1b:40 Uncaught TypeError: Cannot read property ‘getRawIndex’ of undefined at ExtendedClass.getDataParams (dataFormat.js?6c1b:40) at Function.superCall (clazz.js?04d6:107) at ExtendedClass.getDataParams (PieSeries.js?fef3:78) at ECharts.eval (echarts.js?21c7:1386) at Handler.trigger (Eventful.js?aa3b:158) at Handler.dispatchToElement (Handler.js?963e:218) at Handler.mouseout (Handler.js?963e:135) at HandlerDomProxy.trigger (Eventful.js?aa3b:158) at HandlerDomProxy.mouseout (HandlerProxy.js?7bcf:107) at HTMLDivElement.eval (HandlerProxy.js?7bcf:245) getDataParams @ dataFormat.js?6c1b:40 superCall @ clazz.js?04d6:107 getDataParams @ PieSeries.js?fef3:78 (anonymous) @ echarts.js?21c7:1386 trigger @ Eventful.js?aa3b:158 dispatchToElement @ Handler.js?963e:218 mouseout @ Handler.js?963e:135 trigger @ Eventful.js?aa3b:158 mouseout @ HandlerProxy.js?7bcf:107 (anonymous) @ HandlerProxy.js?7bcf:245

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ankushjamdaganicommented, Sep 19, 2019

Issue Reason

I was passing every dynamic config toecharts-for-react component as a prop. Config consited of 1…3 number of series. Exception was raised when the new config doesn’t consist of a series present previously and moving mouse over that series.

Obvious Solution

Stop the event handling when chart is updating.

Fix 1

Show an overlay over chart when it is updating.

  1. chartInstance.showLoading() when change has started. (I did it as soon as the API call for next data is triggered)
  2. chartInstance.hideLoading() when chartInstance.on('finished') event.

Fix 2

chartInstance.setOption does the update with silent (no-event-listening) mode. https://www.echartsjs.com/en/api.html#echartsInstance.setOption

  1. Pass initial config as prop to Echart component.
  2. For next changes, use chartInstance.setOptions(...) instead of passing new config as prop to the component.

Hope this is of use to you guys.

1reaction
a1292999652commented, Dec 10, 2021

setOption<Opt extends ECBasicOption>(option: Opt, notMerge?: boolean, lazyUpdate?: boolean): void; I passed “notMerge” into “true”, this problem occurred, changed to “false”, the problem was solved

Read more comments on GitHub >

github_iconTop Results From Across the Web

[GitHub] [echarts] wayward-man commented on issue #9402
[GitHub] [echarts] wayward-man commented on issue #9402: Cannot read property 'getRawIndex' of undefined.
Read more >
Uncaught TypeError: Cannot read properties of undefined ...
There's a couple of issues here. Firstly the variable element contains a Element object, not a jQuery object, so there is no attr()...
Read more >
[GitHub] [incubator-echarts] j4dream commented on issue #9402 ...
[GitHub] [incubator-echarts] j4dream commented on issue #9402: Cannot read property 'getRawIndex' of undefined. Posted to dev@echarts.apache.org.
Read more >
Creating a flow to find a couple of cells in Microsoft Excel
getRowIndex()) // Get the current active cell in the workbook. ... Runtime error: Line 13: Cannot read property 'getAddress' of undefined
Read more >
i want to apply a script to get and insert date and time in ...
Cannot read property 'getDataRange' of null. getDatetimeCol. @ Code.gs:5 ... getRowIndex(), getDatetimeCol(sheetName));
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