how to read data from a CSV and show it in the page.
xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>show data from CSV</title>
<script src="https://d3js.org/d3.v3.min.js"></script>
</head>
<script type="text/javascript">
var dataset; //Declare global var
var svg = d3.select("body")
.append("svg")
.attr("width", 200)
.attr("height", 500);
d3.csv("data.csv", function(data) {
//Hand CSV data off to global variable so it's accessible later.
dataset = data;
//Call some other functions that
//generate your visualization, e.g.:
showdata();
});
function showdata() {
d3.select("body").selectAll("p")
.data(dataset)
.enter()
.append("p")
.text(function(d) {return d.name +", "+d.age;});
};
</script>
<body>
</body>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js