Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'data_types' of null #22

Open
bvenkatr opened this issue Apr 10, 2017 · 18 comments
Open

Uncaught TypeError: Cannot read property 'data_types' of null #22

bvenkatr opened this issue Apr 10, 2017 · 18 comments

Comments

@bvenkatr
Copy link

bvenkatr commented Apr 10, 2017

Hi, I am getting this error whenever the pie chart is re-rendered by react. This happens only sometimes, not every time react re-renders.
screen shot 2017-04-10 at 10 36 20 pm

@handoff
Copy link

handoff commented May 15, 2017

Me too. If I navigate away within the app, and then come back I get the error. If I reload the page using the browser's button it works. It is only the pie, and the donut that doesn't work.

@forum-is
Copy link

forum-is commented Oct 2, 2017

We're seeing the same issue, although only occasionally. Any updates / ideas what is causing this error?

@AlbertoCalvo
Copy link

Same issue

@jiekang
Copy link

jiekang commented Jan 5, 2018

This can be seen when using c3js in an Angular 2+ application as well for donut/pie charts. I'm pretty certain it's an error in c3js similar to [1].

When you destroy a chart it sets a number of fields to null. However there are timer actions in the background trying to use these fields to render things. In certain conditions, the destroy will set the fields to null before the timer accesses theses fields and things will break spectacularly.

The related fixes in [1] are basically adding null checks to various places. It looks like some more are needed for the donut/pie charts.

[1] c3js/c3#1205

@theonlyfox
Copy link

theonlyfox commented Jan 21, 2018

EDIT: I thought I was on the C3 issues page and realize this is a side project built on C3. I'm using straight C3 and having these same issues, not sure if they are related but I'll leave this here and remove it if asked.

Im getting similar after calling destroy on a "timeseries" chart:

TypeError: $$.data is null[Learn More] c3.js:7890:5
c3_chart_internal_fn.getShapeIndices http://localhost:3000/c3.js:7890:5
c3_chart_internal_fn.redraw http://localhost:3000/c3.js:1490:23
c3_chart_fn.unload/< http://localhost:3000/c3.js:4006:9
c3_chart_internal_fn.endall/< http://localhost:3000/c3.js:2031:13
event http://localhost:3000/d3.js:504:40
tick http://localhost:3000/d3.js:8959:29
start/< http://localhost:3000/d3.js:8936:24
d3_timer_mark http://localhost:3000/d3.js:2166:29
d3_timer_step http://localhost:3000/d3.js:2147:15

By the time I get this error I have destroyed 3 charts and flushed all their data, removed their html containers and destroyed the objects that created them. I have a charts class that handles all the chart creation and manipulation for another class.

In addition, if you have any other charts active after invoking a .destroy() on a chart and attempt to update other charts (using .flow() at least) if will create a massive memory leak that will trap all available memory in a very short period of time.

martinpitt added a commit to martinpitt/cockpit that referenced this issue Jul 23, 2018
This gets triggered by the CPUUsage DonutChart in
pkg/kubernetes/scripts/virtual-machines/components/VmMetricsTab.jsx.

This seems to be some race condition when switching pages, which
supposedly also means "(un)render in React". Cockpit code has no control
over this, and it also does not break the user experience, so ignore the
exception.

See c3js/c3#2187 and simlilar issues
bcbcarl/react-c3js#22 or
c3js/c3#1205.
larskarlitski pushed a commit to cockpit-project/cockpit that referenced this issue Jul 27, 2018
This gets triggered by the CPUUsage DonutChart in
pkg/kubernetes/scripts/virtual-machines/components/VmMetricsTab.jsx.

This seems to be some race condition when switching pages, which
supposedly also means "(un)render in React". Cockpit code has no control
over this, and it also does not break the user experience, so ignore the
exception.

See c3js/c3#2187 and simlilar issues
bcbcarl/react-c3js#22 or
c3js/c3#1205.
martinpitt added a commit to martinpitt/cockpit that referenced this issue Jul 27, 2018
This gets triggered by the CPUUsage DonutChart in
pkg/kubernetes/scripts/virtual-machines/components/VmMetricsTab.jsx.

This seems to be some race condition when switching pages, which
supposedly also means "(un)render in React". Cockpit code has no control
over this, and it also does not break the user experience, so ignore the
exception.

See c3js/c3#2187 and simlilar issues
bcbcarl/react-c3js#22 or
c3js/c3#1205.

Cherry-picked from master commit 436bfe4.
martinpitt added a commit to cockpit-project/cockpit that referenced this issue Jul 29, 2018
This gets triggered by the CPUUsage DonutChart in
pkg/kubernetes/scripts/virtual-machines/components/VmMetricsTab.jsx.

This seems to be some race condition when switching pages, which
supposedly also means "(un)render in React". Cockpit code has no control
over this, and it also does not break the user experience, so ignore the
exception.

See c3js/c3#2187 and simlilar issues
bcbcarl/react-c3js#22 or
c3js/c3#1205.

Cherry-picked from master commit 436bfe4.
@ghost
Copy link

ghost commented Sep 13, 2018

Still throws same error, and crush chart. Adding in my package.json "c3": "^0.6.7" helps to keep chart working but still output error in console

@ayadavkrt
Copy link

I am facing the same issue with pie charts

@damianb86
Copy link

Same issue

@Thebarda
Copy link

Thebarda commented Dec 4, 2018

Hey, same issue here !
Is anyone found a workaround ?

@idandagan1
Copy link

Same issue

@leslie-alldridge
Copy link

me too, any workarounds?

@akhilesh-94
Copy link

Same issue , any workarounds?

@bkanber
Copy link

bkanber commented Feb 22, 2019

I had a similar problem and I think I finally figured it out. The <C3Chart> component takes an unloadBeforeLoad prop, however ALL charts on the page need unloadBeforeLoad={true}. If even one chart is missing the unloadBeforeLoad prop, I get weird chart breakages.

@leslie-alldridge
Copy link

@bkanber I'm glad it's working for you. I've added the prop to all my charts but unfortunately they still display blank and output

Uncaught TypeError: Cannot read property 'data_types' of null
    at k.E.isPieType (c3.js:9223)
    at k.E.isArcType (c3.js:9234)
    at k.E.getArc (c3.js:4473)
    at c3.js:4816
    at SVGPathElement.<anonymous> (d3.js:8775)
    at Object.h [as c] (d3.js:8956)
    at Mt (d3.js:2166)
    at At (d3.js:2147)

If I refresh the page it's all good. I'm using React + Redux.

@bkanber
Copy link

bkanber commented Feb 25, 2019 via email

@leslie-alldridge
Copy link

Thanks for the update @bkanber I've added that to my data object for every chart but continue to get the same error. Files attached
a
c

@michael-brittlebank
Copy link

michael-brittlebank commented Mar 15, 2019

I can confirm that I am still seeing this error with a gauge chart even with adding unloadBeforeLoad and unload on the data objects

@Jiish
Copy link

Jiish commented Apr 11, 2019

+1 for this issue. If chart.destroy() is called inside ngOnDestroy(), the error appears for doughnut and bar charts.

iNecas added a commit to iNecas/foreman-tasks that referenced this issue Jul 12, 2019
There is a known issue in react-c3js that can lead to the charts to
disappear due to some race condition during component unmounting/destroy
phase bcbcarl/react-c3js#22.

Delaying the actual destroy a bit seems to help with workarounding the
issue.
adamruzicka pushed a commit to theforeman/foreman-tasks that referenced this issue Jul 15, 2019
* Fixes #27292 - workaround for c3 destroy issue

There is a known issue in react-c3js that can lead to the charts to
disappear due to some race condition during component unmounting/destroy
phase bcbcarl/react-c3js#22.

Delaying the actual destroy a bit seems to help with workarounding the
issue.

* Refs #27292 - Add note about no need for explicit bind
adamruzicka pushed a commit to adamruzicka/foreman-tasks that referenced this issue Jul 16, 2019
* Fixes #27292 - workaround for c3 destroy issue

There is a known issue in react-c3js that can lead to the charts to
disappear due to some race condition during component unmounting/destroy
phase bcbcarl/react-c3js#22.

Delaying the actual destroy a bit seems to help with workarounding the
issue.

* Refs #27292 - Add note about no need for explicit bind
iNecas added a commit to theforeman/foreman-tasks that referenced this issue Jul 16, 2019
* Fixes #27292 - workaround for c3 destroy issue

There is a known issue in react-c3js that can lead to the charts to
disappear due to some race condition during component unmounting/destroy
phase bcbcarl/react-c3js#22.

Delaying the actual destroy a bit seems to help with workarounding the
issue.

* Refs #27292 - Add note about no need for explicit bind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests