Tzach
Tzach

Reputation: 13406

Google Charts on IE: "Unable to set property 'data' of undefined or null reference"

The following JS exception is thrown while using the Google Charts' Bar Chart on IE:

Unable to set property 'data' of undefined or null reference

However the chart renders correctly.

I tried debugging, but the error is thrown from deep within the charts code. The file that throws the error is:

https://www.google.com/uds/api/visualization/1.0/ce7a9bd29458c92c2c25b7969aaf2727/format+en,default+en,ui+en,corechart+en.I.js

And the line number is 244.

The error is thrown only on IE (tried both 11 and 9), and for other chart types as well.

Has anyone encountered this error before? Any ideas for how to debug this?

Upvotes: 1

Views: 1574

Answers (1)

Tzach
Tzach

Reputation: 13406

Found the answer (thanks @Pointy).

My code was recreating the chart every time the container was resized. On page load there were many resize events that caused the chart to be created multiple times in a very short period.

Changed my code to only call draw again on resize, without creating the chart again, and the error disappeared.

Upvotes: 1

Related Questions