Skip to content

Instantly share code, notes, and snippets.

Created September 24, 2012 19:07
Show Gist options
  • Save anonymous/3777697 to your computer and use it in GitHub Desktop.
Save anonymous/3777697 to your computer and use it in GitHub Desktop.
{
"libraries": [
"d3"
],
"mode": "javascript",
"layout": "sketchpad mode"
}
svg {
position: absolute;
}
.axis path{
fill:none;
stroke: #000000;
}
.axis {
font-size:8pt;
font-family:sans-serif;
}
.tick {
fill:none;
stroke:#000000;
}
circle{
stroke:#000000;
stroke-width:0.5px;
fill:#2B60DE;
opacity:0.6;
}
<div id='chart'></div>
var data = new Array(3,7,9,1,4,6,8,2,5);
var w = 700;
var h = 300;
var max = d3.max(data);
// Scales
var x = d3.scale.linear().domain([0, data.length - 1]).range([0, w]);
var y = d3.scale.linear().domain([0, max]).range([h, 0]);
// Base vis layer
var vis = d3.select('#chart')
.append('svg:svg')
.attr('width', w)
.attr('height', h);
// Add path layer
vis.selectAll('path.line')
.data([data])
.enter().append("svg:path")
.attr("d", d3.svg.line().x((d,i) -> x(i)).y(y));
[
{
"type":"all",
"aggregate":true,
"stats":[
{
"date":"2012-09-24",
"count":3324
},
{
"date":"2012-09-23",
"count":2207
},
{
"date":"2012-09-22",
"count":1647
},
{
"date":"2012-09-21",
"count":3827
},
{
"date":"2012-09-20",
"count":2972
},
{
"date":"2012-09-19",
"count":2633
},
{
"date":"2012-09-18",
"count":1468
},
{
"date":"2012-09-17",
"count":2480
},
{
"date":"2012-09-16",
"count":2916
},
{
"date":"2012-09-15",
"count":2851
},
{
"date":"2012-09-14",
"count":2480
},
{
"date":"2012-09-13",
"count":1684
},
{
"date":"2012-09-12",
"count":2122
},
{
"date":"2012-09-11",
"count":2165
},
{
"date":"2012-09-10",
"count":3049
},
{
"date":"2012-09-09",
"count":2574
},
{
"date":"2012-09-08",
"count":238
},
{
"date":"2012-09-07",
"count":2153
},
{
"date":"2012-09-06",
"count":2514
},
{
"date":"2012-09-05",
"count":425
},
{
"date":"2012-09-04",
"count":2406
},
{
"date":"2012-09-03",
"count":1660
},
{
"date":"2012-09-02",
"count":3047
},
{
"date":"2012-09-01",
"count":1204
},
{
"date":"2012-08-31",
"count":1750
},
{
"date":"2012-08-30",
"count":1381
},
{
"date":"2012-08-29",
"count":1685
},
{
"date":"2012-08-28",
"count":2388
},
{
"date":"2012-08-27",
"count":1002
},
{
"date":"2012-08-26",
"count":727
},
{
"date":"2012-08-25",
"count":2278
},
{
"date":"2012-08-24",
"count":1633
},
{
"date":"2012-08-23",
"count":2521
},
{
"date":"2012-08-22",
"count":3328
},
{
"date":"2012-08-21",
"count":1134
},
{
"date":"2012-08-20",
"count":2403
},
{
"date":"2012-08-19",
"count":4326
},
{
"date":"2012-08-18",
"count":452
},
{
"date":"2012-08-17",
"count":2115
},
{
"date":"2012-08-16",
"count":1487
},
{
"date":"2012-08-15",
"count":1400
},
{
"date":"2012-08-14",
"count":792
},
{
"date":"2012-08-13",
"count":1737
},
{
"date":"2012-08-12",
"count":1356
},
{
"date":"2012-08-11",
"count":1764
},
{
"date":"2012-08-10",
"count":2221
},
{
"date":"2012-08-09",
"count":1921
},
{
"date":"2012-08-08",
"count":1514
},
{
"date":"2012-08-07",
"count":2721
},
{
"date":"2012-08-06",
"count":1427
},
{
"date":"2012-08-05",
"count":1819
},
{
"date":"2012-08-04",
"count":1784
},
{
"date":"2012-08-03",
"count":1424
},
{
"date":"2012-08-02",
"count":2390
},
{
"date":"2012-08-01",
"count":3198
},
{
"date":"2012-07-31",
"count":4514
},
{
"date":"2012-07-30",
"count":1802
},
{
"date":"2012-07-29",
"count":1827
},
{
"date":"2012-07-28",
"count":2407
},
{
"date":"2012-07-27",
"count":3402
}
]
},
{
"type":"fail",
"aggregate":false,
"stats":[
{
"date":"2012-09-24",
"count":65
},
{
"date":"2012-09-23",
"count":347
},
{
"date":"2012-09-22",
"count":1381
},
{
"date":"2012-09-21",
"count":56
},
{
"date":"2012-09-20",
"count":519
},
{
"date":"2012-09-19",
"count":311
},
{
"date":"2012-09-18",
"count":590
},
{
"date":"2012-09-17",
"count":1339
},
{
"date":"2012-09-16",
"count":773
},
{
"date":"2012-09-15",
"count":286
},
{
"date":"2012-09-14",
"count":1338
},
{
"date":"2012-09-13",
"count":603
},
{
"date":"2012-09-12",
"count":747
},
{
"date":"2012-09-11",
"count":46
},
{
"date":"2012-09-10",
"count":925
},
{
"date":"2012-09-09",
"count":783
},
{
"date":"2012-09-08",
"count":25
},
{
"date":"2012-09-07",
"count":1020
},
{
"date":"2012-09-06",
"count":451
},
{
"date":"2012-09-05",
"count":317
},
{
"date":"2012-09-04",
"count":1046
},
{
"date":"2012-09-03",
"count":602
},
{
"date":"2012-09-02",
"count":220
},
{
"date":"2012-09-01",
"count":122
},
{
"date":"2012-08-31",
"count":873
},
{
"date":"2012-08-30",
"count":1083
},
{
"date":"2012-08-29",
"count":178
},
{
"date":"2012-08-28",
"count":752
},
{
"date":"2012-08-27",
"count":161
},
{
"date":"2012-08-26",
"count":216
},
{
"date":"2012-08-25",
"count":1420
},
{
"date":"2012-08-24",
"count":338
},
{
"date":"2012-08-23",
"count":522
},
{
"date":"2012-08-22",
"count":889
},
{
"date":"2012-08-21",
"count":350
},
{
"date":"2012-08-20",
"count":632
},
{
"date":"2012-08-19",
"count":854
},
{
"date":"2012-08-18",
"count":319
},
{
"date":"2012-08-17",
"count":261
},
{
"date":"2012-08-16",
"count":915
},
{
"date":"2012-08-15",
"count":454
},
{
"date":"2012-08-14",
"count":470
},
{
"date":"2012-08-13",
"count":589
},
{
"date":"2012-08-12",
"count":50
},
{
"date":"2012-08-11",
"count":254
},
{
"date":"2012-08-10",
"count":878
},
{
"date":"2012-08-09",
"count":577
},
{
"date":"2012-08-08",
"count":613
},
{
"date":"2012-08-07",
"count":682
},
{
"date":"2012-08-06",
"count":1136
},
{
"date":"2012-08-05",
"count":604
},
{
"date":"2012-08-04",
"count":382
},
{
"date":"2012-08-03",
"count":18
},
{
"date":"2012-08-02",
"count":642
},
{
"date":"2012-08-01",
"count":1324
},
{
"date":"2012-07-31",
"count":1580
},
{
"date":"2012-07-30",
"count":405
},
{
"date":"2012-07-29",
"count":311
},
{
"date":"2012-07-28",
"count":578
},
{
"date":"2012-07-27",
"count":711
}
]
},
{
"type":"cool",
"aggregate":false,
"stats":[
{
"date":"2012-09-24",
"count":1707
},
{
"date":"2012-09-23",
"count":382
},
{
"date":"2012-09-22",
"count":150
},
{
"date":"2012-09-21",
"count":1623
},
{
"date":"2012-09-20",
"count":1235
},
{
"date":"2012-09-19",
"count":1425
},
{
"date":"2012-09-18",
"count":292
},
{
"date":"2012-09-17",
"count":155
},
{
"date":"2012-09-16",
"count":894
},
{
"date":"2012-09-15",
"count":1593
},
{
"date":"2012-09-14",
"count":675
},
{
"date":"2012-09-13",
"count":378
},
{
"date":"2012-09-12",
"count":408
},
{
"date":"2012-09-11",
"count":580
},
{
"date":"2012-09-10",
"count":1227
},
{
"date":"2012-09-09",
"count":241
},
{
"date":"2012-09-08",
"count":79
},
{
"date":"2012-09-07",
"count":738
},
{
"date":"2012-09-06",
"count":1877
},
{
"date":"2012-09-05",
"count":76
},
{
"date":"2012-09-04",
"count":349
},
{
"date":"2012-09-03",
"count":203
},
{
"date":"2012-09-02",
"count":1941
},
{
"date":"2012-09-01",
"count":103
},
{
"date":"2012-08-31",
"count":75
},
{
"date":"2012-08-30",
"count":245
},
{
"date":"2012-08-29",
"count":164
},
{
"date":"2012-08-28",
"count":937
},
{
"date":"2012-08-27",
"count":171
},
{
"date":"2012-08-26",
"count":450
},
{
"date":"2012-08-25",
"count":90
},
{
"date":"2012-08-24",
"count":127
},
{
"date":"2012-08-23",
"count":1448
},
{
"date":"2012-08-22",
"count":1342
},
{
"date":"2012-08-21",
"count":398
},
{
"date":"2012-08-20",
"count":360
},
{
"date":"2012-08-19",
"count":1720
},
{
"date":"2012-08-18",
"count":70
},
{
"date":"2012-08-17",
"count":680
},
{
"date":"2012-08-16",
"count":208
},
{
"date":"2012-08-15",
"count":61
},
{
"date":"2012-08-14",
"count":108
},
{
"date":"2012-08-13",
"count":359
},
{
"date":"2012-08-12",
"count":690
},
{
"date":"2012-08-11",
"count":46
},
{
"date":"2012-08-10",
"count":450
},
{
"date":"2012-08-09",
"count":168
},
{
"date":"2012-08-08",
"count":41
},
{
"date":"2012-08-07",
"count":963
},
{
"date":"2012-08-06",
"count":42
},
{
"date":"2012-08-05",
"count":640
},
{
"date":"2012-08-04",
"count":1261
},
{
"date":"2012-08-03",
"count":598
},
{
"date":"2012-08-02",
"count":949
},
{
"date":"2012-08-01",
"count":248
},
{
"date":"2012-07-31",
"count":1070
},
{
"date":"2012-07-30",
"count":559
},
{
"date":"2012-07-29",
"count":562
},
{
"date":"2012-07-28",
"count":745
},
{
"date":"2012-07-27",
"count":2402
}
]
},
{
"type":"new",
"aggregate":false,
"stats":[
{
"date":"2012-09-24",
"count":1552
},
{
"date":"2012-09-23",
"count":1478
},
{
"date":"2012-09-22",
"count":116
},
{
"date":"2012-09-21",
"count":2148
},
{
"date":"2012-09-20",
"count":1218
},
{
"date":"2012-09-19",
"count":897
},
{
"date":"2012-09-18",
"count":586
},
{
"date":"2012-09-17",
"count":986
},
{
"date":"2012-09-16",
"count":1249
},
{
"date":"2012-09-15",
"count":972
},
{
"date":"2012-09-14",
"count":467
},
{
"date":"2012-09-13",
"count":703
},
{
"date":"2012-09-12",
"count":967
},
{
"date":"2012-09-11",
"count":1539
},
{
"date":"2012-09-10",
"count":897
},
{
"date":"2012-09-09",
"count":1550
},
{
"date":"2012-09-08",
"count":134
},
{
"date":"2012-09-07",
"count":395
},
{
"date":"2012-09-06",
"count":186
},
{
"date":"2012-09-05",
"count":32
},
{
"date":"2012-09-04",
"count":1011
},
{
"date":"2012-09-03",
"count":855
},
{
"date":"2012-09-02",
"count":886
},
{
"date":"2012-09-01",
"count":979
},
{
"date":"2012-08-31",
"count":802
},
{
"date":"2012-08-30",
"count":53
},
{
"date":"2012-08-29",
"count":1343
},
{
"date":"2012-08-28",
"count":699
},
{
"date":"2012-08-27",
"count":670
},
{
"date":"2012-08-26",
"count":61
},
{
"date":"2012-08-25",
"count":768
},
{
"date":"2012-08-24",
"count":1168
},
{
"date":"2012-08-23",
"count":551
},
{
"date":"2012-08-22",
"count":1097
},
{
"date":"2012-08-21",
"count":386
},
{
"date":"2012-08-20",
"count":1411
},
{
"date":"2012-08-19",
"count":1752
},
{
"date":"2012-08-18",
"count":63
},
{
"date":"2012-08-17",
"count":1174
},
{
"date":"2012-08-16",
"count":364
},
{
"date":"2012-08-15",
"count":885
},
{
"date":"2012-08-14",
"count":214
},
{
"date":"2012-08-13",
"count":789
},
{
"date":"2012-08-12",
"count":616
},
{
"date":"2012-08-11",
"count":1464
},
{
"date":"2012-08-10",
"count":893
},
{
"date":"2012-08-09",
"count":1176
},
{
"date":"2012-08-08",
"count":860
},
{
"date":"2012-08-07",
"count":1076
},
{
"date":"2012-08-06",
"count":249
},
{
"date":"2012-08-05",
"count":575
},
{
"date":"2012-08-04",
"count":141
},
{
"date":"2012-08-03",
"count":808
},
{
"date":"2012-08-02",
"count":799
},
{
"date":"2012-08-01",
"count":1626
},
{
"date":"2012-07-31",
"count":1864
},
{
"date":"2012-07-30",
"count":838
},
{
"date":"2012-07-29",
"count":954
},
{
"date":"2012-07-28",
"count":1084
},
{
"date":"2012-07-27",
"count":289
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment