Skip to content

Instantly share code, notes, and snippets.

@karansapolia
Last active June 14, 2017 09:54
Show Gist options
  • Save karansapolia/eca1277cbbf2b1bd1ee988fc94bc1ebb to your computer and use it in GitHub Desktop.
Save karansapolia/eca1277cbbf2b1bd1ee988fc94bc1ebb to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<!-- Load c3.css -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.13/c3.css" rel="stylesheet">
<!-- Load d3.js, d3-queue and c3.js -->
<script src="https://d3js.org/d3-queue.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.13/c3.min.js"></script>
</head>
<body>
<div id="chart"></div>
<script>
d3.queue()
.defer(d3.csv, "https://gist.github.com/karansapolia/0cd64842cd4483300d611feec524d047#file-all_india_crop_wise_yield-csv")
.defer(d3.csv, "https://gist.github.com/karansapolia/0cd64842cd4483300d611feec524d047#file-gross_cap_from_constant_price-csv")
.await(analyze);
function analyze(error, cities, animals) {
if(error) { console.log(error); }
console.log(Rice[0]);
console.log(Year[0]);
}
var chart=c3.generate({
bindto: '#chart',
data: {
url: 'all_india_crop_wise_yield.csv'
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment