Skip to content

Instantly share code, notes, and snippets.

@KyleGobel
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyleGobel/f7b6c0fe9150495bd7b0 to your computer and use it in GitHub Desktop.
Save KyleGobel/f7b6c0fe9150495bd7b0 to your computer and use it in GitHub Desktop.
sameChart
date product gross_profit
2/19/2015 4 -1397.05
2/18/2015 4 -1834.9384
2/18/2015 9 166.3
2/17/2015 9 134.75
2/17/2015 10 -5.32
2/17/2015 4 -3034.26
2/16/2015 4 -2905.1718
2/16/2015 9 115.7
2/16/2015 10 6.35
2/15/2015 9 164.97
2/15/2015 10 -3.4
2/15/2015 4 -2454.0798
2/14/2015 4 -2246.2919
2/14/2015 10 19.52
2/14/2015 9 128.32
2/13/2015 9 111.83
2/13/2015 4 -2567.37
2/13/2015 10 13.22
2/12/2015 10 22.02
2/12/2015 9 168.56
2/12/2015 4 -2087.633
2/11/2015 10 16.74
2/11/2015 4 -1178.6751
2/11/2015 9 222.47
2/10/2015 10 30.31
2/10/2015 4 -53.477
2/10/2015 9 249.85
2/9/2015 9 189.15
2/9/2015 10 -0.41
2/9/2015 4 -118.4532
2/8/2015 4 -109.1137
2/8/2015 10 15.41
2/8/2015 9 269.71
2/7/2015 9 288.91
2/7/2015 4 1307.5604
2/7/2015 10 -1.96
2/6/2015 9 250.77
2/6/2015 4 3624.6054
2/6/2015 10 34.7
2/5/2015 9 228.21
2/5/2015 4 3945.72
2/5/2015 10 37.3
2/4/2015 10 14.42
2/4/2015 9 123.29
2/4/2015 4 1738.5697
2/3/2015 9 305.43
2/3/2015 10 71.02
2/3/2015 4 1942.6509
2/2/2015 4 3038.2362
2/2/2015 10 0.22
2/2/2015 9 275.04
2/1/2015 10 -7.76
2/1/2015 9 98.36
2/1/2015 4 1749.2375
1/31/2015 4 2153.7895
1/31/2015 10 35.39
1/31/2015 9 75.64
1/30/2015 10 21.55
1/30/2015 9 -1.79
1/30/2015 4 3061.4792
1/29/2015 10 24.11
1/29/2015 4 3499.3278
1/29/2015 9 195.65
1/28/2015 10 15.17
1/28/2015 4 498.7132
1/28/2015 9 76.54
1/27/2015 4 409.082
1/27/2015 10 2.83
1/27/2015 9 1.82
1/26/2015 4 710.4938
1/26/2015 9 60.13
1/26/2015 10 7.19
1/25/2015 4 334.0042
1/25/2015 0 -214.71
1/25/2015 10 4.54
1/25/2015 9 166.98
1/24/2015 10 40.3
1/24/2015 4 1225.6301
1/24/2015 0 NULL
1/24/2015 9 251.38
1/23/2015 9 -81.79
1/23/2015 4 2237.9638
1/23/2015 10 42.53
1/22/2015 4 1441.3544
1/22/2015 10 29.47
1/22/2015 9 35.05
1/21/2015 9 69.57
1/21/2015 10 27.17
1/21/2015 4 390.1574
1/20/2015 9 40.72
1/20/2015 10 18.9
1/20/2015 4 1198.3516
1/19/2015 9 10.26
1/19/2015 4 -665.9732
1/19/2015 10 -1394.13
1/18/2015 10 -216.04
1/18/2015 9 276.23
1/18/2015 4 1093.9845
1/17/2015 9 -40.77
1/17/2015 10 -291.11
1/17/2015 4 1826.1696
1/16/2015 10 -18.86
1/16/2015 4 2630.9775
1/16/2015 9 -77.69
1/15/2015 10 -162.84
1/15/2015 4 1929.1005
1/14/2015 4 1756.6971
1/14/2015 9 -58.74
1/14/2015 10 -162.71
1/13/2015 9 -220.14
1/13/2015 10 -195.73
1/13/2015 4 1654.3212
1/12/2015 9 -782.19
1/12/2015 10 -168.74
1/12/2015 4 -9120.943
1/11/2015 9 -884.14
1/11/2015 4 -9319.0927
1/11/2015 10 -197.6
1/10/2015 9 -728.18
1/10/2015 10 -185.74
1/10/2015 4 -6687.6386
1/9/2015 9 -758.91
1/9/2015 4 -12712.205
1/9/2015 10 -158.99
1/8/2015 4 -8757.3405
1/8/2015 10 -200.87
1/8/2015 9 -330.65
1/7/2015 9 -597.15
1/7/2015 10 -66.32
1/7/2015 4 -6538.8362
1/6/2015 4 -6764.5366
1/6/2015 10 -98.71
1/6/2015 9 -753.07
1/5/2015 9 -239.6
1/5/2015 10 -87.04
1/5/2015 4 -11673.3187
1/4/2015 10 -1.08
1/4/2015 4 -4652.801
1/4/2015 9 -694.84
1/3/2015 10 29.33
1/3/2015 9 -749.24
1/3/2015 4 -4320.0728
1/2/2015 4 -5744.4296
1/2/2015 10 -181.12
1/2/2015 9 -444.62
1/1/2015 10 -214.57
1/1/2015 9 -164.96
1/1/2015 4 -5541.4204
12/31/2014 9 -447.44
12/31/2014 4 -6050.836
12/31/2014 10 -203.85
12/30/2014 10 0
12/30/2014 4 -13454.0299
12/30/2014 9 -1031.42
12/29/2014 9 -36.83
12/29/2014 10 0
12/29/2014 4 -9833.0227
12/28/2014 4 -6988.7798
12/28/2014 9 181.04
12/28/2014 10 0
12/27/2014 9 154.67
12/27/2014 4 -4308.2845
12/27/2014 10 0
12/26/2014 9 173
12/26/2014 4 -2666.4556
12/26/2014 10 0
12/25/2014 9 159.93
12/25/2014 4 -5000.7927
12/25/2014 10 -0.48
12/24/2014 9 126.71
12/24/2014 10 -203.39
12/24/2014 4 -7139.3528
12/23/2014 4 -6642.6315
12/23/2014 10 -204.74
12/23/2014 9 98.72
12/22/2014 10 0
12/22/2014 4 -7757.8377
12/22/2014 9 -58.83
12/21/2014 9 -19.53
12/21/2014 10 0
12/21/2014 4 -6045.0629
12/20/2014 4 -7350.1756
12/20/2014 10 0
12/20/2014 9 -96.64
12/19/2014 9 258.12
12/19/2014 10 3.88
12/19/2014 4 -3232.5552
12/18/2014 9 294.11
12/18/2014 10 0
12/18/2014 4 -3730.6791
12/17/2014 9 274.81
12/17/2014 4 -2116.2181
12/17/2014 10 0
12/16/2014 10 -0.4
12/16/2014 9 274.91
12/16/2014 4 -3475.5354
12/15/2014 9 375.39
12/15/2014 4 -3897.3395
12/15/2014 10 -0.2
12/14/2014 10 -0.2
12/14/2014 4 -3339.9128
12/14/2014 9 324.02
12/13/2014 10 0
12/13/2014 9 313.48
12/13/2014 4 -790.2418
12/12/2014 4 -1499.6848
12/12/2014 10 -6.34
12/12/2014 9 276.17
12/11/2014 10 0
12/11/2014 9 236.76
12/11/2014 4 -3787.1248
12/10/2014 4 -4073.4472
12/10/2014 10 0
12/10/2014 9 227.5
12/9/2014 4 -3860.7321
12/9/2014 10 0
12/9/2014 9 381.22
12/8/2014 4 -3624.4421
12/8/2014 9 304.97
12/8/2014 10 0
12/7/2014 4 -2985.4816
12/7/2014 9 -752.51
12/7/2014 10 0
12/6/2014 9 -186.55
12/6/2014 4 -2774.8496
12/6/2014 10 0
12/5/2014 4 -2275.1267
12/5/2014 10 0
12/5/2014 9 -279.57
12/4/2014 9 -825.98
12/4/2014 4 -2723.0373
12/4/2014 10 -82.09
12/3/2014 4 -3440.5801
12/3/2014 10 0
12/3/2014 9 -232.84
12/2/2014 9 179.09
12/2/2014 4 -253.8701
12/2/2014 10 0
12/1/2014 9 142.62
12/1/2014 10 -113.68
12/1/2014 4 -2062.9367
11/30/2014 9 222.31
11/30/2014 4 -3361.9118
11/30/2014 10 -120.54
11/29/2014 9 284.41
11/29/2014 4 -2751.7923
11/28/2014 9 209.74
11/28/2014 4 -2055.3723
11/27/2014 4 -443.8685
11/27/2014 9 106.77
11/26/2014 9 162.12
11/26/2014 4 -720.234
11/25/2014 4 -1606.8838
11/25/2014 9 -492.68
11/24/2014 9 -581.16
11/24/2014 4 -3072.4537
11/23/2014 9 -1331.78
11/23/2014 4 -2495.9211
11/22/2014 4 -2885.3821
11/22/2014 9 -875.34
11/21/2014 9 -26.98
11/21/2014 4 1105.0062
11/20/2014 9 -151.62
11/20/2014 4 458.5144
11/19/2014 9 144.06
11/19/2014 4 1738.2718
11/18/2014 4 -641.2108
11/18/2014 9 -1274.19
11/17/2014 9 -1507.04
11/17/2014 4 -963.4782
11/16/2014 4 -422.3156
11/16/2014 9 -1387.39
11/15/2014 9 -1344.75
11/15/2014 4 -294.3881
11/14/2014 9 -1098.53
11/14/2014 4 -857.6504
11/13/2014 9 -992.87
11/13/2014 4 -1219.3108
11/12/2014 9 -1214.58
11/12/2014 4 -1424.1258
11/11/2014 9 -1106.06
11/11/2014 4 -1158.6868
11/10/2014 4 -1289.864
11/10/2014 9 -833.26
11/9/2014 9 -849.66
11/9/2014 4 -475.51
11/8/2014 4 -831.5277
11/8/2014 9 -734.51
11/7/2014 9 -693.88
11/7/2014 4 -951.2642
11/6/2014 4 -1105.0323
11/6/2014 9 -803.19
11/5/2014 9 -1033.53
11/5/2014 4 -13637.2185
11/4/2014 9 -1852.36
11/4/2014 4 -8914.4646
11/3/2014 4 -2351.3318
11/3/2014 9 -1595.94
11/2/2014 4 -2236.3898
11/2/2014 9 -1600.18
11/1/2014 9 -1452.12
11/1/2014 4 -2192.6107
10/31/2014 4 -1792.4677
10/31/2014 9 -1172.02
10/30/2014 9 -288.06
10/30/2014 4 -2254.1117
10/29/2014 9 -99.52
10/29/2014 4 -2626.0285
10/28/2014 9 -130.81
10/28/2014 4 -2494.8354
10/27/2014 9 -127.88
10/27/2014 4 -2644.0866
10/26/2014 9 -604.26
10/26/2014 4 -2393.1699
10/25/2014 9 -59.04
10/25/2014 4 -2539.2674
10/24/2014 4 -2643.4756
10/24/2014 9 -0.76
10/23/2014 4 -3000.1435
10/22/2014 4 -2520.6237
10/21/2014 4 -2464.1777
10/20/2014 4 -2194.3624
10/19/2014 4 -516.6446
10/18/2014 4 -395.9341
10/17/2014 4 -652.5906
10/16/2014 4 -1210.3771
10/15/2014 4 -1761.4264
10/14/2014 4 -1450.3237
10/13/2014 4 -559.8879
10/12/2014 4 -499.9516
10/11/2014 4 -624.3492
10/10/2014 4 -744.8495
10/9/2014 4 -528.037
10/8/2014 4 -824.4951
10/7/2014 4 -1028.3203
10/6/2014 4 -947.5037
10/5/2014 4 -485.2097
10/4/2014 4 -517.3222
10/3/2014 4 -909.8062
10/2/2014 4 -2558.58
10/1/2014 4 -2990.99
9/30/2014 4 -3005.74
9/29/2014 4 -2860.83
9/28/2014 4 -2935.92
9/27/2014 4 -2998.89
9/26/2014 4 -2786.17
9/25/2014 4 -3712.39
9/24/2014 4 -3066.22
9/23/2014 4 -3178.63
9/22/2014 4 -2942.72
9/21/2014 4 -2909.07
9/20/2014 4 -2967.92
9/19/2014 4 -2607.52
9/18/2014 4 -2022.1
9/17/2014 4 -2546.53
9/16/2014 4 -2659.26
9/15/2014 4 -3340.32
9/14/2014 4 -2852.62
9/13/2014 4 -3016.6
9/12/2014 4 -3442.04
9/11/2014 4 -6270.94
9/10/2014 4 -5920.53
9/9/2014 4 -6741.37
9/8/2014 4 -8133.87
9/7/2014 4 -7904.62
9/6/2014 4 -8035.32
9/5/2014 4 -13518.66
9/4/2014 4 -9278.61
9/3/2014 4 -13202.74
9/2/2014 4 -12485.54
9/1/2014 4 -8925.38
8/31/2014 4 -8785.36
8/30/2014 4 -9122.93
8/29/2014 4 -9562.87
8/28/2014 4 -10256.31
8/27/2014 4 -6658.41
8/26/2014 4 -7216.33
8/25/2014 4 -7317.97
8/24/2014 4 -6280.48
8/23/2014 4 -5012.44
8/22/2014 4 -10468.05
8/21/2014 4 -6979.61
8/20/2014 4 -7784.98
8/19/2014 4 -5985.62
8/18/2014 4 -3546.16
8/17/2014 4 -3010.67
8/16/2014 4 -3031.46
8/15/2014 4 -5000.41
<!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.gross_profit);})
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.tsv("data.tsv", function(error, data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
});
x.domain(d3.extend(data, function(d) { return d.date;}));
y.domain(d3.extent(data, function(d) { return d.gross_profit;}));
});
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