xxxxxxxxxx
<meta charset="utf-8">
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400italic,600italic,700italic,200,300,400,600,700,900">
<script src="https://d3js.org/d3.v3.min.js"></script>
<style>
body, h1, h2, h3, p {
margin: 0;
padding: 0;
font-family: 'Source Sans Pro', sans-serif;
font-size: 1em;
color: #333;
font-weight: 400;
}
#content {
margin: 5px;
padding: 20px 10px 20px 20px;
width: 780px;
text-align: left;
border: 1px solid #ccc;
}
h1 {
line-height: 1em;
font-size: 1.75em;
font-weight: 900;
color: #000;
}
p {
margin: 5px 0px 0px 0px;
padding: 0;
}
.domain {
stroke-width: 0;
}
path.line {
fill: none;
stroke: #08306b;
stroke-width: 2px;
}
.axis path, .axis line {
fill: none;
stroke: #ccc;
shape-rendering: crispEdges;
}
.axis line {
stroke: #eee;
stroke-width: 1;
shape-rendering: crispEdges;
}
.g-baseline line {
stroke: #333;
stroke-width: 2;
shape-rendering: crispEdges;
}
.x.axis .tick text, .y.axis .tick text {
color: #333;
font-size: 0.9em;
}
</style>
</head>
<body>
<div id="content">
<h1>S&P 500 Stock Price Index</h1>
<p>Jan 2000–Feb 2014</p>
<div id="chart"></div>
<p>Source: S&P Dow Jones Indices.</p>
</div>
<script src="chart.js"></script>
<script>
var chart = timeSeriesChart()
.x(function(d) { return formatDate.parse(d.date); })
.y(function(d) { return +d.price; });
var formatDate = d3.time.format("%Y-%m-%d");
d3.csv("data.csv", function(data) {
d3.select("#chart")
.datum(data)
.call(chart);
});
d3.select(self.frameElement).style("height", "555px");
</script>
</body>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js