Last active
August 29, 2015 14:05
-
-
Save dcalacci/754ad73e3621f0a0b766 to your computer and use it in GitHub Desktop.
line chart testing, d3.js
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2 in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date trips | |
2012-10-01 61.0 | |
2012-10-02 56.0 | |
2012-10-03 58.0 | |
2012-10-04 50.0 | |
2012-10-05 80.0 | |
2012-10-06 80.0 | |
2012-10-07 37.0 | |
2012-10-08 53.0 | |
2012-10-09 50.0 | |
2012-10-10 42.0 | |
2012-10-11 72.0 | |
2012-10-12 48.0 | |
2012-10-13 61.0 | |
2012-10-14 42.0 | |
2012-10-15 58.0 | |
2012-10-16 50.0 | |
2012-10-17 70.0 | |
2012-10-18 73.0 | |
2012-10-19 51.0 | |
2012-10-20 122.0 | |
2012-10-21 84.0 | |
2012-10-22 76.0 | |
2012-10-23 62.0 | |
2012-10-24 65.0 | |
2012-10-25 68.0 | |
2012-10-26 83.0 | |
2012-10-27 75.0 | |
2012-10-28 40.0 | |
2012-10-29 1.0 | |
2012-10-30 16.0 | |
2012-10-31 54.0 | |
2012-11-01 63.0 | |
2012-11-02 70.0 | |
2012-11-03 72.0 | |
2012-11-04 46.0 | |
2012-11-05 48.0 | |
2012-11-06 42.0 | |
2012-11-07 38.0 | |
2012-11-08 27.0 | |
2012-11-09 59.0 | |
2012-11-10 70.0 | |
2012-11-11 65.0 | |
2012-11-12 53.0 | |
2012-11-13 33.0 | |
2012-11-14 44.0 | |
2012-11-15 45.0 | |
2012-11-16 47.0 | |
2012-11-17 53.0 | |
2012-11-18 42.0 | |
2012-11-19 30.0 | |
2012-11-20 46.0 | |
2012-11-21 46.0 | |
2012-11-22 29.0 | |
2012-11-23 29.0 | |
2012-11-24 25.0 | |
2012-11-25 17.0 | |
2012-11-26 31.0 | |
2012-11-27 3.0 | |
2012-11-28 0.0 | |
2012-11-29 0.0 | |
2012-11-30 0.0 | |
2012-12-01 0.0 | |
2012-12-02 0.0 | |
2012-12-03 0.0 | |
2012-12-04 0.0 | |
2012-12-05 0.0 | |
2012-12-06 0.0 | |
2012-12-07 0.0 | |
2012-12-08 0.0 | |
2012-12-09 0.0 | |
2012-12-10 0.0 | |
2012-12-11 0.0 | |
2012-12-12 0.0 | |
2012-12-13 0.0 | |
2012-12-14 0.0 | |
2012-12-15 0.0 | |
2012-12-16 0.0 | |
2012-12-17 0.0 | |
2012-12-18 0.0 | |
2012-12-19 0.0 | |
2012-12-20 0.0 | |
2012-12-21 0.0 | |
2012-12-22 0.0 | |
2012-12-23 0.0 | |
2012-12-24 0.0 | |
2012-12-25 0.0 | |
2012-12-26 0.0 | |
2012-12-27 0.0 | |
2012-12-28 0.0 | |
2012-12-29 0.0 | |
2012-12-30 0.0 | |
2012-12-31 0.0 | |
2013-01-01 0.0 | |
2013-01-02 0.0 | |
2013-01-03 0.0 | |
2013-01-04 0.0 | |
2013-01-05 0.0 | |
2013-01-06 0.0 | |
2013-01-07 0.0 | |
2013-01-08 0.0 | |
2013-01-09 0.0 | |
2013-01-10 0.0 | |
2013-01-11 0.0 | |
2013-01-12 0.0 | |
2013-01-13 0.0 | |
2013-01-14 0.0 | |
2013-01-15 0.0 | |
2013-01-16 0.0 | |
2013-01-17 0.0 | |
2013-01-18 0.0 | |
2013-01-19 0.0 | |
2013-01-20 0.0 | |
2013-01-21 0.0 | |
2013-01-22 0.0 | |
2013-01-23 0.0 | |
2013-01-24 0.0 | |
2013-01-25 0.0 | |
2013-01-26 0.0 | |
2013-01-27 0.0 | |
2013-01-28 0.0 | |
2013-01-29 0.0 | |
2013-01-30 0.0 | |
2013-01-31 0.0 | |
2013-02-01 0.0 | |
2013-02-02 0.0 | |
2013-02-03 0.0 | |
2013-02-04 0.0 | |
2013-02-05 0.0 | |
2013-02-06 0.0 | |
2013-02-07 0.0 | |
2013-02-08 0.0 | |
2013-02-09 0.0 | |
2013-02-10 0.0 | |
2013-02-11 0.0 | |
2013-02-12 0.0 | |
2013-02-13 0.0 | |
2013-02-14 0.0 | |
2013-02-15 0.0 | |
2013-02-16 0.0 | |
2013-02-17 0.0 | |
2013-02-18 0.0 | |
2013-02-19 0.0 | |
2013-02-20 0.0 | |
2013-02-21 0.0 | |
2013-02-22 0.0 | |
2013-02-23 0.0 | |
2013-02-24 0.0 | |
2013-02-25 0.0 | |
2013-02-26 0.0 | |
2013-02-27 0.0 | |
2013-02-28 0.0 | |
2013-03-01 0.0 | |
2013-03-02 0.0 | |
2013-03-03 0.0 | |
2013-03-04 0.0 | |
2013-03-05 0.0 | |
2013-03-06 0.0 | |
2013-03-07 0.0 | |
2013-03-08 0.0 | |
2013-03-09 0.0 | |
2013-03-10 0.0 | |
2013-03-11 0.0 | |
2013-03-12 0.0 | |
2013-03-13 0.0 | |
2013-03-14 0.0 | |
2013-03-15 0.0 | |
2013-03-16 0.0 | |
2013-03-17 0.0 | |
2013-03-18 0.0 | |
2013-03-19 0.0 | |
2013-03-20 0.0 | |
2013-03-21 0.0 | |
2013-03-22 0.0 | |
2013-03-23 0.0 | |
2013-03-24 0.0 | |
2013-03-25 0.0 | |
2013-03-26 0.0 | |
2013-03-27 0.0 | |
2013-03-28 0.0 | |
2013-03-29 0.0 | |
2013-03-30 0.0 | |
2013-03-31 0.0 | |
2013-04-01 0.0 | |
2013-04-02 14.0 | |
2013-04-03 27.0 | |
2013-04-04 44.0 | |
2013-04-05 37.0 | |
2013-04-06 60.0 | |
2013-04-07 47.0 | |
2013-04-08 51.0 | |
2013-04-09 57.0 | |
2013-04-10 38.0 | |
2013-04-11 51.0 | |
2013-04-12 29.0 | |
2013-04-13 65.0 | |
2013-04-14 44.0 | |
2013-04-15 71.0 | |
2013-04-16 55.0 | |
2013-04-17 75.0 | |
2013-04-18 75.0 | |
2013-04-19 12.0 | |
2013-04-20 79.0 | |
2013-04-21 66.0 | |
2013-04-22 61.0 | |
2013-04-23 23.0 | |
2013-04-24 59.0 | |
2013-04-25 73.0 | |
2013-04-26 91.0 | |
2013-04-27 99.0 | |
2013-04-28 133.0 | |
2013-04-29 73.0 | |
2013-04-30 77.0 | |
2013-05-01 70.0 | |
2013-05-02 60.0 | |
2013-05-03 77.0 | |
2013-05-04 95.0 | |
2013-05-05 70.0 | |
2013-05-06 59.0 | |
2013-05-07 67.0 | |
2013-05-08 73.0 | |
2013-05-09 61.0 | |
2013-05-10 80.0 | |
2013-05-11 64.0 | |
2013-05-12 78.0 | |
2013-05-13 81.0 | |
2013-05-14 74.0 | |
2013-05-15 76.0 | |
2013-05-16 79.0 | |
2013-05-17 105.0 | |
2013-05-18 111.0 | |
2013-05-19 77.0 | |
2013-05-20 61.0 | |
2013-05-21 64.0 | |
2013-05-22 60.0 | |
2013-05-23 59.0 | |
2013-05-24 34.0 | |
2013-05-25 23.0 | |
2013-05-26 49.0 | |
2013-05-27 93.0 | |
2013-05-28 80.0 | |
2013-05-29 50.0 | |
2013-05-30 69.0 | |
2013-05-31 67.0 | |
2013-06-01 85.0 | |
2013-06-02 111.0 | |
2013-06-03 47.0 | |
2013-06-04 69.0 | |
2013-06-05 80.0 | |
2013-06-06 72.0 | |
2013-06-07 23.0 | |
2013-06-08 71.0 | |
2013-06-09 85.0 | |
2013-06-10 54.0 | |
2013-06-11 36.0 | |
2013-06-12 72.0 | |
2013-06-13 46.0 | |
2013-06-14 51.0 | |
2013-06-15 108.0 | |
2013-06-16 84.0 | |
2013-06-17 64.0 | |
2013-06-18 53.0 | |
2013-06-19 88.0 | |
2013-06-20 71.0 | |
2013-06-21 113.0 | |
2013-06-22 79.0 | |
2013-06-23 118.0 | |
2013-06-24 59.0 | |
2013-06-25 79.0 | |
2013-06-26 87.0 | |
2013-06-27 64.0 | |
2013-06-28 103.0 | |
2013-06-29 92.0 | |
2013-06-30 121.0 | |
2013-07-01 91.0 | |
2013-07-02 99.0 | |
2013-07-03 102.0 | |
2013-07-04 126.0 | |
2013-07-05 73.0 | |
2013-07-06 84.0 | |
2013-07-07 82.0 | |
2013-07-08 72.0 | |
2013-07-09 87.0 | |
2013-07-10 99.0 | |
2013-07-11 79.0 | |
2013-07-12 118.0 | |
2013-07-13 113.0 | |
2013-07-14 103.0 | |
2013-07-15 94.0 | |
2013-07-16 77.0 | |
2013-07-17 84.0 | |
2013-07-18 104.0 | |
2013-07-19 85.0 | |
2013-07-20 110.0 | |
2013-07-21 98.0 | |
2013-07-22 103.0 | |
2013-07-23 79.0 | |
2013-07-24 122.0 | |
2013-07-25 79.0 | |
2013-07-26 69.0 | |
2013-07-27 122.0 | |
2013-07-28 96.0 | |
2013-07-29 102.0 | |
2013-07-30 97.0 | |
2013-07-31 106.0 | |
2013-08-01 105.0 | |
2013-08-02 109.0 | |
2013-08-03 121.0 | |
2013-08-04 121.0 | |
2013-08-05 86.0 | |
2013-08-06 95.0 | |
2013-08-07 98.0 | |
2013-08-08 87.0 | |
2013-08-09 58.0 | |
2013-08-10 122.0 | |
2013-08-11 96.0 | |
2013-08-12 70.0 | |
2013-08-13 104.0 | |
2013-08-14 115.0 | |
2013-08-15 101.0 | |
2013-08-16 109.0 | |
2013-08-17 116.0 | |
2013-08-18 103.0 | |
2013-08-19 100.0 | |
2013-08-20 92.0 | |
2013-08-21 82.0 | |
2013-08-22 120.0 | |
2013-08-23 119.0 | |
2013-08-24 127.0 | |
2013-08-25 107.0 | |
2013-08-26 97.0 | |
2013-08-27 109.0 | |
2013-08-28 111.0 | |
2013-08-29 87.0 | |
2013-08-30 139.0 | |
2013-08-31 97.0 | |
2013-09-01 66.0 | |
2013-09-02 108.0 | |
2013-09-03 125.0 | |
2013-09-04 94.0 | |
2013-09-05 92.0 | |
2013-09-06 90.0 | |
2013-09-07 133.0 | |
2013-09-08 107.0 | |
2013-09-09 87.0 | |
2013-09-10 87.0 | |
2013-09-11 109.0 | |
2013-09-12 94.0 | |
2013-09-13 89.0 | |
2013-09-14 114.0 | |
2013-09-15 124.0 | |
2013-09-16 87.0 | |
2013-09-17 108.0 | |
2013-09-18 77.0 | |
2013-09-19 109.0 | |
2013-09-20 121.0 | |
2013-09-21 104.0 | |
2013-09-22 98.0 | |
2013-09-23 77.0 | |
2013-09-24 105.0 | |
2013-09-25 100.0 | |
2013-09-26 103.0 | |
2013-09-27 93.0 | |
2013-09-28 127.0 | |
2013-09-29 89.0 | |
2013-09-30 77.0 | |
2013-10-01 103.0 | |
2013-10-02 116.0 | |
2013-10-03 114.0 | |
2013-10-04 113.0 | |
2013-10-05 130.0 | |
2013-10-06 52.0 | |
2013-10-07 73.0 | |
2013-10-08 91.0 | |
2013-10-09 95.0 | |
2013-10-10 99.0 | |
2013-10-11 114.0 | |
2013-10-12 93.0 | |
2013-10-13 96.0 | |
2013-10-14 101.0 | |
2013-10-15 87.0 | |
2013-10-16 116.0 | |
2013-10-17 89.0 | |
2013-10-18 117.0 | |
2013-10-19 124.0 | |
2013-10-20 125.0 | |
2013-10-21 87.0 | |
2013-10-22 85.0 | |
2013-10-23 77.0 | |
2013-10-24 97.0 | |
2013-10-25 94.0 | |
2013-10-26 85.0 | |
2013-10-27 85.0 | |
2013-10-28 72.0 | |
2013-10-29 82.0 | |
2013-10-30 89.0 | |
2013-10-31 81.0 | |
2013-11-01 93.0 | |
2013-11-02 130.0 | |
2013-11-03 71.0 | |
2013-11-04 52.0 | |
2013-11-05 77.0 | |
2013-11-06 80.0 | |
2013-11-07 69.0 | |
2013-11-08 72.0 | |
2013-11-09 65.0 | |
2013-11-10 73.0 | |
2013-11-11 71.0 | |
2013-11-12 48.0 | |
2013-11-13 73.0 | |
2013-11-14 60.0 | |
2013-11-15 78.0 | |
2013-11-16 72.0 | |
2013-11-17 50.0 | |
2013-11-18 60.0 | |
2013-11-19 59.0 | |
2013-11-20 56.0 | |
2013-11-21 73.0 | |
2013-11-22 42.0 | |
2013-11-23 60.0 | |
2013-11-24 35.0 | |
2013-11-25 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} | |
.x.axis path { | |
display: none; | |
} | |
.line { | |
fill: none; | |
stroke: steelblue; | |
stroke-width: 1.5px; | |
} | |
</style> | |
<body> | |
<script src="http://d3js.org/d3.v3.js"></script> | |
<script> | |
var margin = {top: 20, right: 20, bottom: 30, left: 50}, | |
width = 960 - margin.left - margin.right, | |
height = 500 - margin.top - margin.bottom; | |
var parseDate = d3.time.format("%d-%b-%y").parse; | |
var x = d3.time.scale() | |
.range([0, width]); | |
var y = d3.scale.linear() | |
.range([height, 0]); | |
var xAxis = d3.svg.axis() | |
.scale(x) | |
.orient("bottom"); | |
var yAxis = d3.svg.axis() | |
.scale(y) | |
.orient("left"); | |
var line = d3.svg.line() | |
.x(function(d) { return x(d.date); }) | |
.y(function(d) { return y(d.close); }); | |
var svg = d3.select("body").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 + ")"); | |
d3.csv("data.tsv", function(error, data) { | |
data.forEach(function(d) { | |
d.date = parseDate(d.date); | |
d.close = +d.close; | |
}); | |
x.domain(d3.extent(data, function(d) { return d.date; })); | |
y.domain(d3.extent(data, function(d) { return d.close; })); | |
svg.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(0," + height + ")") | |
.call(xAxis); | |
svg.append("g") | |
.attr("class", "y axis") | |
.call(yAxis) | |
.append("text") | |
.attr("transform", "rotate(-90)") | |
.attr("y", 6) | |
.attr("dy", ".71em") | |
.style("text-anchor", "end") | |
.text("Price ($)"); | |
svg.append("path") | |
.datum(data) | |
.attr("class", "line") | |
.attr("d", line); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment