xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>Power and Channel for 50 Stations</title>
<script type="text/javascript" src="https://d3js.org/d3.v3.js"></script>
<style type="text/css">
body {
background-color: white;
}
svg {
background-color: white;
}
</style>
</head>
<body>
<script type="text/javascript">
var svg = d3.select("body")
.append("svg")
.attr("width", 800)
.attr("height", 500);
d3.csv("fm_eng_data.csv", function(data) {
data.sort(function(a, b) {
return d3.descending(a.station_channel, b.station_channel);
});
var rects = svg.selectAll("rect")
.data(data)
.enter()
.append("rect")
.attr("fill", function(d){
return "rgb("+d.horiz_erp * 2 +","+d.horiz_erp * 1+","+d.horiz_erp * 2+")"});
rects.attr("x", 0)
.attr("y", function(d, i) {
return i * 10;
})
.attr("width", function(d) {
return d.station_channel;
})
.attr("height", 6)
.append("title")
.text(function(d) {
return "a class " + d.station_class + " station radiating " + d.horiz_erp + " kW on channel " + d.station_channel;
});
});
</script>
</body>
</html>
Modified http://d3js.org/d3.v3.js to a secure url
https://d3js.org/d3.v3.js