i am trying to make a graph in javascript using chart.js. i have this code below but when i run it the page is empty. this code is an example that ive seen in the internet, and it says that it doesn't recognize the "generate" function in the javascrpt file (it doesnt throws an exception or an error, just marks the "generate" word in gray and doesn't shows anything when i run the code)
this is the html code:
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.js"></script>
</head>
<body>
<div id ="myChart"></div>
<script><script src="lol.js"></script></script>
</body>
</html>
this is the js code:
var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
}
});
setTimeout(function () {
chart.load({
columns: [
['data1', 230, 190, 300, 500, 300, 400]
]
});
}, 1000);
setTimeout(function () {
chart.load({
columns: [
['data3', 130, 150, 200, 300, 200, 100]
]
});
}, 1500);
setTimeout(function () {
chart.unload({
ids: 'data1'
});
}, 2000);
how can i fix that? i need to make a graph to my project with javascript and i trying to find out a way how. thanks!