Skip to content

Instantly share code, notes, and snippets.

@vsajip
Forked from mbostock/.block
Last active February 23, 2016 08:45
Show Gist options
  • Save vsajip/ac28399285210a491778 to your computer and use it in GitHub Desktop.
Save vsajip/ac28399285210a491778 to your computer and use it in GitHub Desktop.
Test Chart
license: gpl-3.0
date close
2011-04-01 01:00:00 0.01
2011-04-01 01:00:01 0.01
2011-04-30 00:59:59 0.01
2011-04-30 01:00:00 0.01
2011-04-30 01:00:01 0.010000462962962963
2011-05-01 00:59:59 0.04999953703703704
2011-05-01 01:00:00 0.5800000000000001
2011-05-01 01:00:01 0.5800000000000001
2011-05-31 00:59:59 0.5800000000000001
2011-05-31 01:00:00 0.5800000000000001
2011-05-31 01:00:01 0.5300008101851852
2011-06-01 00:59:59 0.5999991898148148
2011-06-01 01:00:00 0.7100000000000001
2011-06-01 01:00:01 0.7100000000000001
2011-06-30 00:59:59 0.7100000000000001
2011-06-30 01:00:00 0.7100000000000001
2011-06-30 01:00:01 0.5500002314814815
2011-07-01 00:59:59 0.5699997685185185
2011-07-01 01:00:00 0.6100000000000001
2011-07-01 01:00:01 0.6100000000000001
2011-07-31 00:59:59 0.6100000000000001
2011-07-31 01:00:00 0.6100000000000001
2011-07-31 01:00:01 0.5999931712962963
2011-08-01 00:59:59 0.010006828703703757
2011-08-01 01:00:00 0.01
2011-08-01 01:00:01 0.01
2011-08-31 00:59:59 0.01
2011-08-31 01:00:00 0.01
2011-12-01 00:00:00 0.03
2011-12-01 00:00:01 0.03
2011-12-30 23:59:59 0.03
2011-12-31 00:00:00 0.03
2011-12-31 00:00:01 0.029999652777777778
2011-12-31 23:59:59 3.4722222222449695e-7
2012-01-01 00:00:00 0
2012-01-01 00:00:01 0
2012-03-31 00:59:59 0
2012-03-31 01:00:00 0
2012-03-31 01:00:01 0.000005324074074074074
2012-04-01 00:59:59 0.4599946759259259
2012-04-01 01:00:00 0.5
2012-04-01 01:00:01 0.5
2012-04-30 00:59:59 0.5
2012-04-30 01:00:00 0.5
2012-04-30 01:00:01 0.49999872685185187
2012-05-01 00:59:59 0.3900012731481482
2012-05-01 01:00:00 0.39
2012-05-01 01:00:01 0.39
2012-05-31 00:59:59 0.39
2012-05-31 01:00:00 0.39
2012-05-31 01:00:01 0.2999966435185185
2012-06-01 00:59:59 0.010003356481481476
2012-06-01 01:00:00 0.01
2012-06-01 01:00:01 0.01
2012-06-30 00:59:59 0.01
2012-06-30 01:00:00 0.01
2012-06-30 01:00:01 0.010000925925925927
2012-07-01 00:59:59 0.08999907407407406
2012-07-01 01:00:00 0.09
2012-07-01 01:00:01 0.09
2012-07-31 00:59:59 0.09
2012-07-31 01:00:00 0.09
2012-07-31 01:00:01 0.08999907407407406
2012-08-01 00:59:59 0.010000925925925927
2012-08-01 01:00:00 0.01
2012-08-01 01:00:01 0.01
2012-08-31 00:59:59 0.01
2012-08-31 01:00:00 0.01
2012-08-31 01:00:01 0.01
2012-09-01 00:59:59 0.01
2012-09-01 01:00:00 0.04
2012-09-01 01:00:01 0.04
2012-09-30 00:59:59 0.04
2012-09-30 01:00:00 0.04
2012-09-30 01:00:01 0.040000925925925926
2012-10-01 00:59:59 0.11999907407407406
2012-10-01 01:00:00 0.12
2012-10-01 01:00:01 0.12
2012-10-30 23:59:59 0.12
2012-10-31 00:00:00 0.12
2012-10-31 00:00:01 0.11999895833333332
2012-10-31 23:59:59 0.03000104166666666
2012-11-01 00:00:00 0.03
2012-11-01 00:00:01 0.03
2012-11-29 23:59:59 0.03
2012-11-30 00:00:00 0.03
2012-11-30 00:00:01 0.03000046296296296
2012-11-30 23:59:59 0.06999953703703704
2012-12-01 00:00:00 0.09
2012-12-01 00:00:01 0.09
2012-12-30 23:59:59 0.09
2012-12-31 00:00:00 0.09
2012-12-31 00:00:01 0.07999907407407407
2012-12-31 23:59:59 9.259259259319919e-7
2013-01-01 00:00:00 0
2013-01-01 00:00:01 0
2013-01-30 23:59:59 0
2013-01-31 00:00:00 0
2013-01-31 00:00:01 9.25925925925926e-7
2013-01-31 23:59:59 0.07999907407407407
2013-02-01 00:00:00 0.08
2013-02-01 00:00:01 0.08
2013-02-27 23:59:59 0.08
2013-02-28 00:00:00 0.08
2013-02-28 00:00:01 0.07999918981481481
2013-02-28 23:59:59 0.010000810185185192
2013-03-01 00:00:00 0.01
2013-03-01 00:00:01 0.01
2013-03-30 23:59:59 0.01
2013-03-31 00:00:00 0.01
2013-03-31 00:00:01 0.01000011574074074
2013-04-01 00:59:59 0.01999988425925926
2013-04-01 01:00:00 0.02
2013-04-01 01:00:01 0.02
2013-04-30 00:59:59 0.02
2013-04-30 01:00:00 0.02
2013-04-30 01:00:01 0.0000030092592592592593
2013-05-01 00:59:59 0.25999699074074073
2013-05-01 01:00:00 0.26
2013-05-01 01:00:01 0.26
2013-05-31 00:59:59 0.26
2013-05-31 01:00:00 0.26
2013-05-31 01:00:01 0.029999652777777778
2013-06-01 00:59:59 3.4722222222449695e-7
2013-06-01 01:00:00 0
2013-06-01 01:00:01 0
2013-07-01 01:00:00 0.02
2013-07-01 01:00:01 0.02
2013-07-31 00:59:59 0.02
2013-07-31 01:00:00 0.02
2013-07-31 01:00:01 0.019999768518518517
2013-08-01 00:59:59 2.3148148148299796e-7
2013-08-01 01:00:00 0
2013-08-01 01:00:01 0
2013-08-31 00:59:59 0
2013-08-31 01:00:00 0
2013-08-31 01:00:01 0.000001388888888888889
2013-09-01 00:59:59 0.11999861111111111
2013-09-01 01:00:00 0.14
2013-09-01 01:00:01 0.14
2013-09-30 00:59:59 0.14
2013-09-30 01:00:00 0.14
2013-09-30 01:00:01 0.1300011574074074
2013-10-01 00:59:59 0.22999884259259257
2013-10-01 01:00:00 0.23
2013-10-01 01:00:01 0.23
2013-10-30 23:59:59 0.23
2013-10-31 00:00:00 0.23
2013-10-31 00:00:01 0.05999965277777777
2013-10-31 23:59:59 0.030000347222222223
2013-11-01 00:00:00 0.03
2013-11-01 00:00:01 0.03
2013-11-29 23:59:59 0.03
2013-11-30 00:00:00 0.03
2013-11-30 00:00:01 0.03000023148148148
2013-11-30 23:59:59 0.04999976851851852
2013-12-01 00:00:00 0.62
2013-12-01 00:00:01 0.62
2013-12-30 23:59:59 0.62
2013-12-31 00:00:00 0.62
2013-12-31 00:00:01 0.619996412037037
2013-12-31 23:59:59 0.3100035879629629
2014-01-01 00:00:00 0.33
2014-01-01 00:00:01 0.33
2014-01-30 23:59:59 0.33
2014-01-31 00:00:00 0.33
2014-01-31 00:00:01 0.30999641203703704
2014-01-31 23:59:59 0.000003587962962958713
2014-02-01 00:00:00 0
2014-02-01 00:00:01 0
2014-02-27 23:59:59 0
2014-02-28 00:00:00 0
2014-02-28 00:00:01 0.00000625
2014-02-28 23:59:59 0.53999375
2014-03-01 00:00:00 0.54
2014-03-01 00:00:01 0.54
2014-03-31 00:59:59 0.54
2014-03-31 01:00:00 0.54
2014-03-31 01:00:01 0.5399991898148149
2014-04-01 00:59:59 0.4700008101851852
2014-04-01 01:00:00 2.3699999999999997
2014-04-01 01:00:01 2.3699999999999997
2014-04-30 00:59:59 2.3699999999999997
2014-04-30 01:00:00 2.3699999999999997
2014-04-30 01:00:01 2.369996990740741
2014-05-01 00:59:59 2.110003009259259
2014-05-01 01:00:00 2.11
2014-05-01 01:00:01 2.11
2014-05-31 00:59:59 2.11
2014-05-31 01:00:00 2.11
2014-05-31 01:00:01 2.109998726851852
2014-06-01 00:59:59 2.0000012731481482
2014-06-01 01:00:00 2.0599999999999996
2014-06-01 01:00:01 2.0599999999999996
2014-06-30 00:59:59 2.0599999999999996
2014-06-30 01:00:00 2.0599999999999996
2014-06-30 01:00:01 1.8500184027777777
2014-07-01 00:59:59 3.4399815972222223
2014-07-01 01:00:00 3.52
2014-07-01 01:00:01 3.52
2014-07-31 00:59:59 3.52
2014-07-31 01:00:00 3.52
2014-07-31 01:00:01 2.9899880787037034
2014-08-01 00:59:59 1.9600119212962963
2014-08-01 01:00:00 1.9600000000000002
2014-08-01 01:00:01 1.9600000000000002
2014-08-31 00:59:59 1.9600000000000002
2014-08-31 01:00:00 1.9600000000000002
2014-08-31 01:00:01 1.949996412037037
2014-09-01 00:59:59 1.640003587962963
2014-09-01 01:00:00 1.68
2014-09-01 01:00:01 1.68
2014-09-30 00:59:59 1.68
2014-09-30 01:00:00 1.68
2014-09-30 01:00:01 1.5900201388888888
2014-10-01 00:59:59 3.3299798611111115
2014-10-01 01:00:00 3.35
2014-10-01 01:00:01 3.35
2014-10-30 23:59:59 3.35
2014-10-31 00:00:00 3.35
2014-10-31 00:00:01 2.6499891203703707
2014-10-31 23:59:59 1.7100108796296296
2014-11-01 00:00:00 2.4800000000000004
2014-11-01 00:00:01 2.4800000000000004
2014-11-29 23:59:59 2.4800000000000004
2014-11-30 00:00:00 2.4800000000000004
2014-11-30 00:00:01 2.2400028935185183
2014-11-30 23:59:59 2.4899971064814816
2014-12-01 00:00:00 2.49
2014-12-01 00:00:01 2.49
2014-12-30 23:59:59 2.49
2014-12-31 00:00:00 2.49
2014-12-31 00:00:01 2.4900033564814814
2014-12-31 23:59:59 2.7799966435185186
2015-01-01 00:00:00 2.81
2015-01-01 00:00:01 2.81
2015-01-30 23:59:59 2.81
2015-01-31 00:00:00 2.81
2015-01-31 00:00:01 2.550009606481481
2015-01-31 23:59:59 3.3799903935185176
2015-02-01 00:00:00 4.26
2015-02-01 00:00:01 4.26
2015-02-27 23:59:59 4.26
2015-02-28 00:00:00 4.26
2015-02-28 00:00:01 3.58002800925926
2015-02-28 23:59:59 5.999971990740741
2015-03-01 00:00:00 6
2015-03-01 00:00:01 6
2015-03-31 00:59:59 6
2015-03-31 01:00:00 6
2015-03-31 01:00:01 5.850000462962963
2015-04-01 00:59:59 5.8899995370370375
2015-04-01 01:00:00 6.859999999999999
2015-04-01 01:00:01 6.859999999999999
2015-04-30 00:59:59 6.859999999999999
2015-04-30 01:00:00 6.859999999999999
2015-04-30 01:00:01 6.8399855324074075
2015-05-01 00:59:59 5.590014467592592
2015-05-01 01:00:00 5.59
2015-05-01 01:00:01 5.59
2015-05-31 00:59:59 5.59
2015-05-31 01:00:00 5.59
2015-05-31 01:00:01 5.040023842592593
2015-06-01 00:59:59 7.099976157407408
2015-06-01 01:00:00 7.1
2015-06-01 01:00:01 7.1
2015-06-30 00:59:59 7.1
2015-06-30 01:00:00 7.1
2015-06-30 01:00:01 6.129973726851852
2015-07-01 00:59:59 3.8600262731481476
2015-07-01 01:00:00 4.3999999999999995
2015-07-01 01:00:01 4.3999999999999995
2015-07-31 00:59:59 4.3999999999999995
2015-07-31 01:00:00 4.3999999999999995
2015-07-31 01:00:01 4.4000006944444445
2015-08-01 00:59:59 4.459999305555556
2015-08-01 01:00:00 4.5
2015-08-01 01:00:01 4.5
2015-08-31 00:59:59 4.5
2015-08-31 01:00:00 4.5
2015-08-31 01:00:01 4.459990972222222
2015-09-01 00:59:59 3.6800090277777775
2015-09-01 01:00:00 3.6800000000000006
2015-09-01 01:00:01 3.6800000000000006
2015-09-30 00:59:59 3.6800000000000006
2015-09-30 01:00:00 3.6800000000000006
2015-09-30 01:00:01 2.799991435185185
2015-10-01 00:59:59 2.0600085648148148
2015-10-01 01:00:00 2.06
2015-10-01 01:00:01 2.06
2015-10-30 23:59:59 2.06
2015-10-31 00:00:00 2.06
2015-10-31 00:00:01 2.0599994212962964
2015-10-31 23:59:59 2.0100005787037034
2015-11-01 00:00:00 3.1199999999999997
2015-11-01 00:00:01 3.1199999999999997
2015-11-29 23:59:59 3.1199999999999997
2015-11-30 00:00:00 3.1199999999999997
2015-11-30 00:00:01 3.089992013888889
2015-11-30 23:59:59 2.400007986111111
2015-12-01 00:00:00 2.85
2015-12-01 00:00:01 2.85
2015-12-30 23:59:59 2.85
2015-12-31 00:00:00 2.85
2015-12-31 00:00:01 2.0700251157407408
2015-12-31 23:59:59 4.23997488425926
2016-01-01 00:00:00 5.739999999999999
2016-01-01 00:00:01 5.739999999999999
2016-01-30 23:59:59 5.739999999999999
2016-01-31 00:00:00 5.739999999999999
2016-01-31 00:00:01 4.369986226851852
2016-01-31 23:59:59 3.180013773148148
2016-02-01 00:00:00 3.18
2016-02-01 00:00:01 3.18
2016-02-28 23:59:59 3.18
2016-02-29 00:00:00 3.18
2016-02-29 00:00:01 3.1299959490740745
2016-02-29 23:59:59 2.7800040509259256
2016-03-01 00:00:00 2.7799999999999994
2016-03-01 00:00:01 2.7799999999999994
2016-03-31 00:59:59 2.7799999999999994
2016-03-31 01:00:00 2.7799999999999994
2016-03-31 01:00:01 2.0500048611111112
2016-04-01 00:59:59 2.4699951388888888
2016-04-01 01:00:00 2.58
2016-04-01 01:00:01 2.58
2016-04-30 00:59:59 2.58
2016-04-30 01:00:00 2.58
2016-04-30 01:00:01 2.4700040509259256
2016-05-01 00:59:59 2.8199959490740736
2016-05-01 01:00:00 2.82
2016-05-01 01:00:01 2.82
2016-05-31 00:59:59 2.82
2016-05-31 01:00:00 2.82
2016-05-31 01:00:01 2.8200026620370373
2016-06-01 00:59:59 3.049997337962963
2016-06-01 01:00:00 3.0500000000000003
2016-06-01 01:00:01 3.0500000000000003
2016-06-30 00:59:59 3.0500000000000003
2016-06-30 01:00:00 3.0500000000000003
2016-06-30 01:00:01 2.1600059027777774
2016-07-01 00:59:59 2.6699940972222223
2016-07-01 01:00:00 2.67
2016-07-01 01:00:01 2.67
2016-08-31 00:59:59 2.67
2016-08-31 01:00:00 2.67
2016-08-31 01:00:01 2.670006134259259
2016-09-01 00:59:59 3.1999938657407405
2016-09-01 01:00:00 3.1999999999999997
2016-09-01 01:00:01 3.1999999999999997
2016-09-30 00:59:59 3.1999999999999997
2016-09-30 01:00:00 3.1999999999999997
2016-09-30 01:00:01 3.2000071759259257
2016-10-01 00:59:59 3.819992824074074
2016-10-01 01:00:00 3.82
2016-10-01 01:00:01 3.82
2016-11-29 23:59:59 3.82
2016-11-30 00:00:00 3.82
2016-11-30 00:00:01 3.820006597222222
2016-11-30 23:59:59 4.389993402777778
2016-12-01 00:00:00 4.39
2016-12-01 00:00:01 4.39
2016-12-30 23:59:59 4.39
2016-12-31 00:00:00 4.39
2016-12-31 00:00:01 4.389993402777778
2016-12-31 23:59:59 3.820006597222222
2017-01-01 00:00:00 3.82
2017-01-01 00:00:01 3.82
2017-02-27 23:59:59 3.82
2017-02-28 00:00:00 3.82
2017-02-28 00:00:01 3.8200109953703705
2017-02-28 23:59:59 4.76998900462963
2017-03-01 00:00:00 4.77
2017-03-01 00:00:01 4.77
2017-03-31 00:59:59 4.77
2017-03-31 01:00:00 4.77
2017-03-31 01:00:01 4.7699718749999995
2017-04-01 00:59:59 2.3400281250000003
2017-04-01 01:00:00 2.34
2017-04-01 01:00:01 2.34
2017-04-30 00:59:59 2.34
2017-04-30 01:00:00 2.34
2017-05-31 00:59:59 2.33
2017-05-31 01:00:00 2.33
2017-05-31 01:00:01 2.330006712962963
2017-06-01 00:59:59 2.9099932870370373
2017-06-01 01:00:00 2.91
2017-06-01 01:00:01 2.91
2017-06-30 00:59:59 2.91
2017-06-30 01:00:00 2.91
2017-06-30 01:00:01 2.9099677083333333
2017-07-01 00:59:59 0.12003229166666651
2017-07-01 01:00:00 0.12
2017-07-01 01:00:01 0.12
2017-07-31 00:59:59 0.12
2017-07-31 01:00:00 0.12
2017-07-31 01:00:01 0.12000034722222222
2017-08-01 00:59:59 0.14999965277777777
2017-08-01 01:00:00 0.15
2017-08-01 01:00:01 0.15
2017-08-31 00:59:59 0.15
2017-08-31 01:00:00 0.15
2017-08-31 01:00:01 0.14999965277777777
2017-09-01 00:59:59 0.12000034722222222
2017-09-01 01:00:00 0.12
2017-09-01 01:00:01 0.12
2017-09-30 00:59:59 0.12
2017-09-30 01:00:00 0.12
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.area {
fill: steelblue;
}
</style>
<body>
<script src="//d3js.org/d3.v3.min.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("%Y-%m-%d %H:%M:%S").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 area = d3.svg.area()
.x(function(d) { return x(d.date); })
.y0(height)
.y1(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.tsv("data.tsv", function(error, data) {
if (error) throw error;
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([0, d3.max(data, function(d) { return d.close; })]);
svg.append("path")
.datum(data)
.attr("class", "area")
.attr("d", area);
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 ($)"); */
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment