-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinechart.html
32 lines (26 loc) · 967 Bytes
/
linechart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Load d3.js -->
<script src="https://d3js.org/d3.v4.js"></script>
<body onload='init()'>
<!-- Create a div where the graph will take place -->
<div id="my_dataviz"></div>
</body>
<script>
async function init() {
// set the dimensions and margins of the graph
var margin = {top: 10, right: 30, bottom: 30, left: 60},
width = 460 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom;
// append the svg object to the body of the page
var svg = d3.select("#my_dataviz")
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");
data = await d3.csv( "https://sheidkamp.github.io/data/college/college_costs.csv")
console.log("Data loaded")
}
</script>