Built with blockbuilder.org
forked from altocumulus's block: [SO 41190304] Loading data from a second CSV
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<pre id="output"></pre>
<script>
d3.csv("file1.csv", data1 => {
let map = d3.map(data1, d => d.name);
d3.csv("file2.csv",
row => (map.get(row.name).desc = row.desc,null),
() => {d3.select("#output").text(JSON.stringify(data1, null, 2))}
);
});
</script>
</body>
https://d3js.org/d3.v4.min.js