This example summarizes a data table using Datalib.
This data is from NASA. It contains the parameters that describe orbits for 160 near-Earth comets, i.e., comets that pass close to Earth (see also this Wikipedia entry on near-Earth objects).
forked from curran's block: Data Table Summary
forked from jpasini's block: Run169 Data Table Summary
forked from jpasini's block: Near-Earth Comets data summary
xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>Near-Earth Comets - Data Summary</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/datalib@1.8.0/datalib.min.js"></script>
<style>
</style>
</head>
<body>
<script>
// Load and summarize the data.
d3.csv('comets.csv', data => {
// Assemble a summary string.
const summary = [
'Data table summary: ',
data.length + ' rows',
data.columns.length + ' columns',
Math.round(d3.csvFormat(data).length / 1024) + ' kB',
'\nSummary of each column:',
dl.format.summary(data)
].join('\n');
// Show the summary string on the page.
d3.select('body').append('pre').text(summary);
// Log the summary to the console.
console.log(summary);
});
</script>
</body>
</html>
https://d3js.org/d3.v4.min.js
https://unpkg.com/datalib@1.8.0/datalib.min.js