I am trying to reproduce the grouped bar chart using D3 from Observable. I am running the script on Chrome, with D3.v5.
In the script I have:
var data = Object.assign(await d3.csv("https://gist.githubusercontent.com/mbostock/3887051/raw/805adad40306cedf1a513c252ddd95e7c981885a/data.csv",
d3.autoType), {
y: "Population"
});
When I ran it in the HTML, it shows the following error:
Uncaught SyntaxError: missing ) after argument list
I tried it on the Chrome console, it works fine.
HTML file content:
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script>
var margin = {top: 10, right: 10, bottom: 20, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var data = Object.assign(await d3.csv("https://gist.githubusercontent.com/mbostock/3887051/raw/805adad40306cedf1a513c252ddd95e7c981885a/data.csv", d3.autoType), {y: "Population"});
</script>
When successful, data should be a object as the following:
[{…}, {…}, {…}, {…}, {…}, {…}, columns: Array(8), y: "Population"]