Uncaught TypeError: Cannot read property 'width' of undefined
See original GitHub issueWith the latest release c3 release (download link from main website) and d3.v3.min.js
Google Chrome 36.0.1985.49 beta
I am surprised this doesn’t work right out of the box. Am I doing something wrong?
<!DOCTYPE html>
<html>
<head>
<link href="c3.css" rel="stylesheet" type="text/css">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="c3.js"></script>
<script>
var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
}
});
</script>
</head>
<body>
<div class='chart'>
<div id="chart"></div>
</div>
</body>
</html>
Issue Analytics
- State:
- Created 9 years ago
- Comments:7
Top Results From Across the Web
Cannot read property 'width' of undefined in JavaScript - Stack ...
Here canvas variable is undefined . You trying to access canvas before settings its value. var canvas=document.getElementById("canvas ...
Read more >Cannot read property 'width' of undefined (Image Function ...
Uncaught TypeError: Cannot read property 'width' of undefined (Image Function) · Issue #4749 · processing/p5. js · GitHub.
Read more >Read property 'width' undefined - Processing forum
Hi, I am somewhat of an intro coder for p5.js. Anyways, I am working on some code that changes a drawFunction I made...
Read more >Issue with "TypeError Cannot read property 'width' of ...
basically the key part of the error message is the "of undefined". that always means that the engine is missing a data object,...
Read more >Getting error as "Cannot read property 'width' of undefined"
I am trying to draw a solidgauge chart. Above one is a configuration of chart. I am working on angular and already imported...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If I move the JavaScript to the bottom of ‘body’ tag it works. Interesting… Can someone please comment as to why this is necessary before I close this issue? Thanks!
try this way to solve problem: use script inside the body tag like this: