Skip to content

Instantly share code, notes, and snippets.

@meetwudi
Forked from enjalot/brush.js
Last active August 29, 2015 14:21
Show Gist options
  • Save meetwudi/40fe871ccb7b28b3c18f to your computer and use it in GitHub Desktop.
Save meetwudi/40fe871ccb7b28b3c18f to your computer and use it in GitHub Desktop.
if(!d3.chart) d3.chart = {};
d3.chart.brush = function() {
var g;
var data;
var width = 600;
var height = 30;
var dispatch = d3.dispatch(chart, "filter");
function chart(container) {
g = container;
var extent = d3.extent(data, function(d) {
return d.data.created
})
var scale = d3.time.scale()
.domain(extent)
.range([0, width])
var brush = d3.svg.brush()
brush.x(scale)
brush(g)
g.selectAll("rect").attr("height", height)
g.selectAll(".background")
.style({fill: "#4B9E9E", visibility: "visible"})
g.selectAll(".extent")
.style({fill: "#78C5C5", visibility: "visible"})
g.selectAll(".resize rect")
.style({fill: "#276C86", visibility: "visible"})
var rects = g.selectAll("rect.events")
.data(data)
rects.enter()
.append("rect").classed("events", true)
rects.attr({
x: function(d) { return scale(d.data.created);},
y: 0,
width: 1,
height: height
}).style("pointer-events", "none")
rects.exit().remove()
brush.on("brushend", function() {
var ext = brush.extent()
var filtered = data.filter(function(d) {
return (d.data.created > ext[0] && d.data.created < ext[1])
})
g.selectAll("rect.events")
.style("stroke", "")
g.selectAll("rect.events")
.data(filtered, function(d) { return d.data.id })
.style({
stroke: "#fff"
})
//emit filtered data
dispatch.filter(filtered)
})
var axis = d3.svg.axis()
.scale(scale)
.orient("bottom")
.tickValues([new Date(extent[0]), new Date(extent[0] + (extent[1] - extent[0])/2) , new Date(extent[1])])
.tickFormat(d3.time.format("%x %H:%M"))
var agroup = g.append("g")
agroup.attr("transform", "translate(" + [0, height] + ")")
axis(agroup)
agroup.selectAll("path")
.style({ fill: "none", stroke: "#000"})
agroup.selectAll("line")
.style({ stroke: "#000"})
}
chart.highlight = function(data) {
var rects = g.selectAll("rect.events")
.style("stroke", "")
.style("stroke-width", "")
rects.data(data, function(d) { return d.data.id })
.style("stroke", "orange")
.style("stroke-width", 3)
}
chart.data = function(value) {
if(!arguments.length) return data;
data = value;
return chart;
}
chart.width = function(value) {
if(!arguments.length) return width;
width = value;
return chart;
}
chart.height = function(value) {
if(!arguments.length) return height;
height = value;
return chart;
}
return d3.rebind(chart, dispatch, "on");
}
if(!d3.chart) d3.chart = {};
d3.chart.histogram = function() {
var g;
var data;
var width = 400;
var height = 400;
var cx = 10;
var numberBins = 5;
var dispatch = d3.dispatch(chart, "hover");
function chart(container) {
g = container;
update();
}
chart.update = update;
function update() {
var hist = d3.layout.histogram()
.value(function(d) { return d.data.score })
.range([0, d3.max(data, function(d){ return d.data.score }) ])
.bins(numberBins);
var layout = hist(data);
var maxLength = d3.max(layout, function(d) { return d.length });
var widthScale = d3.scale.linear()
.domain([0, maxLength])
.range([0, width])
var yScale = d3.scale.ordinal()
.domain(d3.range(numberBins))
.rangeBands([height, 0], 0.1)
var colorScale = d3.scale.category20();
var rects = g.selectAll("rect")
.data(layout)
rects.enter().append("rect")
rects
.transition()
.attr({
y: function(d,i) {
return yScale(i)
},
x: 50,
height: yScale.rangeBand(),
width: function(d,i) {
return widthScale(d.length)
},
fill: function(d, i) { return colorScale(i) }
})
rects.exit().transition().remove();
rects.on("mouseover", function(d) {
d3.select(this).style("fill", "orange")
console.log("hist over", d)
dispatch.hover(d)
})
rects.on("mouseout", function(d) {
d3.select(this).style("fill", "")
dispatch.hover([])
})
}
chart.data = function(value) {
if(!arguments.length) return data;
data = value;
return chart;
}
chart.width = function(value) {
if(!arguments.length) return width;
width = value;
return chart;
}
chart.height = function(value) {
if(!arguments.length) return height;
height = value;
return chart;
}
return d3.rebind(chart, dispatch, "on");
}
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<style>
svg {
width: 960px;
height: 500px;
border: 1px solid gray;
}
.table {
width: 960px;
height: 500px;
overflow: scroll;
}
.axis {
font-size: 10px;
}
.axis path {
fill: none;
stroke: #000000;
}
.axis .tick line {
stroke: #000;
}
</style>
</head>
<body>
<svg></svg>
<div id="display"></div>
<script src="http://d3js.org/d3.v3.js"></script>
<script src="table.js"></script>
<script src="scatter.js"></script>
<script src="brush.js"></script>
<script src="histogram.js"></script>
<script>
var display = d3.select("#display");
d3.json("pics.json", function(err, pics) {
var data = pics.data.children;
data.forEach(function(d) {
d.data.created *= 1000;
})
console.log(data);
var display = d3.select("#display")
//table
var tdiv = display.append("div").classed("table", true)
var table = d3.chart.table()
table.data(data)
table(tdiv);
var svg = d3.select("svg")
//scatter plot
var sgroup = svg.append("g")
.attr("transform", "translate(50, 0)")
var scatter = d3.chart.scatter()
scatter.data(data)
scatter(sgroup)
//histogram
var hgroup = svg.append("g")
.attr("transform", "translate(450, 0)")
var histogram = d3.chart.histogram()
histogram.data(data)
histogram(hgroup)
//brush
var bgroup = svg.append("g")
.attr("transform", "translate(100, 430)")
var brush = d3.chart.brush()
brush
.data(data)
.width(800)
brush(bgroup)
brush.on("filter", function(filtered) {
console.log("filtered", filtered);
scatter.data(filtered);
scatter.update();
table.data(filtered)
table.update();
histogram.data(filtered)
histogram.update();
})
table.on("hover", function(hovered) {
scatter.highlight(hovered)
brush.highlight(hovered)
})
scatter.on("hover", function(hovered) {
table.highlight(hovered)
brush.highlight(hovered)
})
histogram.on("hover", function(hovered) {
table.highlight(hovered)
scatter.highlight(hovered)
brush.highlight(hovered)
})
})
</script>
</body>
</html>
{
"kind": "Listing",
"data": {
"modhash": "dfkwd1sl2kf3ab48050f92b682d6ac6a55f294278be0a1cf50",
"children": [
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlz6j",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "wear_r_your_pants",
"media": null,
"score": 2899,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://a.thumbs.redditmedia.com/2eqS6DyDSsSeLnnZ.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 4394,
"is_self": false,
"permalink": "/r/pics/comments/1mlz6j/i_should_probably_check_whats_under_the_stove/",
"name": "t3_1mlz6j",
"created": 1379493146,
"url": "http://imgur.com/FuW3Qnd",
"author_flair_text": null,
"title": "I should probably check whats under the stove",
"created_utc": 1379464346,
"link_flair_text": null,
"ups": 7293,
"num_comments": 242,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlvag",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "DizzleDe",
"media": null,
"score": 1685,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://c.thumbs.redditmedia.com/DgNR2wx7ejsNV9p8.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 1079,
"is_self": false,
"permalink": "/r/pics/comments/1mlvag/art_on_a_steel_beam_under_a_bridge/",
"name": "t3_1mlvag",
"created": 1379489987,
"url": "http://imgur.com/hHzSk4a",
"author_flair_text": null,
"title": "Art on a steel beam under a bridge.",
"created_utc": 1379461187,
"link_flair_text": null,
"ups": 2764,
"num_comments": 21,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlk75",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "dirtymindfilthyways",
"media": null,
"score": 2558,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/EM13DNfeuIsxqI5W.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 4837,
"is_self": false,
"permalink": "/r/pics/comments/1mlk75/jrr_tolkien_looking_at_flowers/",
"name": "t3_1mlk75",
"created": 1379481466,
"url": "http://i.imgur.com/RxILAYz.jpg",
"author_flair_text": null,
"title": "JRR Tolkien Looking at Flowers",
"created_utc": 1379452666,
"link_flair_text": null,
"ups": 7395,
"num_comments": 241,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1ml74x",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "horse_you_rode_in_on",
"media": null,
"score": 3337,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/5PC9EMAKXnvet83p.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 38646,
"is_self": false,
"permalink": "/r/pics/comments/1ml74x/patrick_stewart_marries_sunny_ozell_in_a_ceremony/",
"name": "t3_1ml74x",
"created": 1379471983,
"url": "http://i.imgur.com/cdpiJdF.jpg",
"author_flair_text": null,
"title": "Patrick Stewart marries Sunny Ozell, in a ceremony officiated by Ian McKellen",
"created_utc": 1379443183,
"link_flair_text": null,
"ups": 41983,
"num_comments": 1446,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlacf",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "averagedekutree",
"media": null,
"score": 2453,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://b.thumbs.redditmedia.com/_GfV8EEPO1S2XwL1.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 2275,
"is_self": false,
"permalink": "/r/pics/comments/1mlacf/class_of_1913_yearbook/",
"name": "t3_1mlacf",
"created": 1379474345,
"url": "http://imgur.com/a/5twkk",
"author_flair_text": null,
"title": "Class of 1913 Yearbook",
"created_utc": 1379445545,
"link_flair_text": null,
"ups": 4728,
"num_comments": 438,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mljvv",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "mrwhiskers123",
"media": null,
"score": 1665,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/D0hkhS98kjLJZmSQ.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 988,
"is_self": false,
"permalink": "/r/pics/comments/1mljvv/beautiful_backyard_view/",
"name": "t3_1mljvv",
"created": 1379481226,
"url": "http://imgur.com/7VNGF36",
"author_flair_text": null,
"title": "beautiful backyard view",
"created_utc": 1379452426,
"link_flair_text": null,
"ups": 2653,
"num_comments": 53,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mldzq",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "JacktheNasty",
"media": null,
"score": 2027,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/kz4wZz4pcn8shl8K.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 8562,
"is_self": false,
"permalink": "/r/pics/comments/1mldzq/i_finally_got_my_halo_off_reddit_its_a_good_day/",
"name": "t3_1mldzq",
"created": 1379477037,
"url": "http://i.imgur.com/plhghxx.jpg",
"author_flair_text": null,
"title": "I finally got my halo off, Reddit. It's a good day to be alive.",
"created_utc": 1379448237,
"link_flair_text": null,
"ups": 10589,
"num_comments": 655,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1ml697",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "jesbaker",
"media": null,
"score": 2615,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://c.thumbs.redditmedia.com/S3PsF2peZZt5AGpV.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 4554,
"is_self": false,
"permalink": "/r/pics/comments/1ml697/flowers_refracted_within_dew_drops/",
"name": "t3_1ml697",
"created": 1379471313,
"url": "http://i.imgur.com/w7P3FSi.jpg",
"author_flair_text": null,
"title": "Flowers refracted within dew drops.",
"created_utc": 1379442513,
"link_flair_text": null,
"ups": 7169,
"num_comments": 41,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlraz",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "Vanderwoolf",
"media": null,
"score": 1151,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/VoJyFNBDMHceRIFv.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 2513,
"is_self": false,
"permalink": "/r/pics/comments/1mlraz/i_had_a_breakthrough_yesterday_with_my_cat_that/",
"name": "t3_1mlraz",
"created": 1379486911,
"url": "http://imgur.com/a/WfJiJ",
"author_flair_text": null,
"title": "I had a breakthrough yesterday with my cat that nearly brought me to tears. Story w/pics.",
"created_utc": 1379458111,
"link_flair_text": null,
"ups": 3664,
"num_comments": 169,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1ml5ow",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "mygrapefruit",
"media": null,
"score": 2536,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/roAbJKrYeR2PRbC3.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 14399,
"is_self": false,
"permalink": "/r/pics/comments/1ml5ow/accidentally_shot_a_evolutionary_perspective/",
"name": "t3_1ml5ow",
"created": 1379470882,
"url": "http://i.imgur.com/AgLcteX.jpg",
"author_flair_text": null,
"title": "Accidentally shot a evolutionary perspective photo of my two brothers and dad",
"created_utc": 1379442082,
"link_flair_text": null,
"ups": 16935,
"num_comments": 473,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlwyd",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "jmailangi",
"media": null,
"score": 842,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/Oi9NZyHK9v65sa4X.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 173,
"is_self": false,
"permalink": "/r/pics/comments/1mlwyd/control_room_of_a_submarine_in_1918_xpost_from/",
"name": "t3_1mlwyd",
"created": 1379491336,
"url": "http://i.imgur.com/OnMc8HO.jpg",
"author_flair_text": null,
"title": "Control room of a submarine in 1918 (x-post from /r/militaryporn)",
"created_utc": 1379462536,
"link_flair_text": null,
"ups": 1015,
"num_comments": 53,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mky5a",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "vamonos_pest",
"media": null,
"score": 2512,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/T8lgfORz9TzHvybe.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 24595,
"is_self": false,
"permalink": "/r/pics/comments/1mky5a/my_local_sams_club_is_selling_a_barrel_of_jack/",
"name": "t3_1mky5a",
"created": 1379465116,
"url": "http://i.imgur.com/x7eSCAZ.jpg",
"author_flair_text": null,
"title": "My local Sam's Club is selling a barrel of Jack Daniels",
"created_utc": 1379436316,
"link_flair_text": null,
"ups": 27107,
"num_comments": 2214,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkxco",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "mrcarlita",
"media": null,
"score": 2561,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/sQrM7jlRAxUfEEM5.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 10350,
"is_self": false,
"permalink": "/r/pics/comments/1mkxco/went_to_pee_at_a_party_and_saw_this_dope_shower/",
"name": "t3_1mkxco",
"created": 1379439331,
"url": "http://i.imgur.com/k2ys9BE.jpg",
"author_flair_text": null,
"title": "Went to pee at a party and saw this dope shower",
"created_utc": 1379435731,
"link_flair_text": null,
"ups": 12911,
"num_comments": 571,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkxkq",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "fuck_they_found_me",
"media": null,
"score": 2417,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://a.thumbs.redditmedia.com/efR5Gen3rd-rbNIT.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 16870,
"is_self": false,
"permalink": "/r/pics/comments/1mkxkq/patrick_stewart_just_posted_this_on_twitter/",
"name": "t3_1mkxkq",
"created": 1379464707,
"url": "http://i.imgur.com/yNWOq9H.jpg",
"author_flair_text": null,
"title": "Patrick Stewart just posted this on Twitter.",
"created_utc": 1379435907,
"link_flair_text": null,
"ups": 19287,
"num_comments": 501,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1ml5ns",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "BottledBlondePhD",
"media": null,
"score": 1553,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/RtYy8bh8MNC67YDq.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 1056,
"is_self": false,
"permalink": "/r/pics/comments/1ml5ns/allllllll_by_myselffffff/",
"name": "t3_1ml5ns",
"created": 1379470858,
"url": "http://imgur.com/ZV8UYBz",
"author_flair_text": null,
"title": "Allllllll by myselffffff...",
"created_utc": 1379442058,
"link_flair_text": null,
"ups": 2609,
"num_comments": 69,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mm4rr",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "DonTago",
"media": null,
"score": 376,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/hbmCyWhN3hFTEiiM.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 118,
"is_self": false,
"permalink": "/r/pics/comments/1mm4rr/a_red_tsunami_of_sand_off_the_coast_of_australia/",
"name": "t3_1mm4rr",
"created": 1379497740,
"url": "http://i.imgur.com/IgWZXsN.jpg",
"author_flair_text": null,
"title": "A red tsunami of sand off the coast of Australia",
"created_utc": 1379468940,
"link_flair_text": null,
"ups": 494,
"num_comments": 24,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkrq0",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "samkick19",
"media": null,
"score": 2545,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://a.thumbs.redditmedia.com/gnkN07FM1M8voWBx.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 19219,
"is_self": false,
"permalink": "/r/pics/comments/1mkrq0/dat_feel/",
"name": "t3_1mkrq0",
"created": 1379460123,
"url": "http://i.imgur.com/pYEXuwV.jpg",
"author_flair_text": null,
"title": "Dat feel",
"created_utc": 1379431323,
"link_flair_text": null,
"ups": 21764,
"num_comments": 418,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkslu",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "thenamesteve",
"media": null,
"score": 2402,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://a.thumbs.redditmedia.com/3HzLjucaLOZ92LSx.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 3180,
"is_self": false,
"permalink": "/r/pics/comments/1mkslu/orange_chicken/",
"name": "t3_1mkslu",
"created": 1379460837,
"url": "http://i.imgur.com/EUV7Qse.jpg",
"author_flair_text": null,
"title": "Orange chicken",
"created_utc": 1379432037,
"link_flair_text": null,
"ups": 5582,
"num_comments": 105,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlt10",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "rocketwikkit",
"media": null,
"score": 515,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/XAWPZZGbVHBmGd94.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 97,
"is_self": false,
"permalink": "/r/pics/comments/1mlt10/dedicated_hitchhikers_guide_fans_send_vase_of/",
"name": "t3_1mlt10",
"created": 1379488236,
"url": "http://imgur.com/7IIMF9n",
"author_flair_text": null,
"title": "Dedicated Hitchhiker's Guide fans send vase of petunias to near space",
"created_utc": 1379459436,
"link_flair_text": null,
"ups": 612,
"num_comments": 29,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mksk4",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "thenamesteve",
"media": null,
"score": 1965,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/No_q2up6ykbPJgeF.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 5012,
"is_self": false,
"permalink": "/r/pics/comments/1mksk4/coffee_leaking_out_the_cracks_of_a_mug/",
"name": "t3_1mksk4",
"created": 1379460803,
"url": "http://i.imgur.com/iDwjSsX.jpg",
"author_flair_text": null,
"title": "Coffee leaking out the cracks of a mug",
"created_utc": 1379432003,
"link_flair_text": null,
"ups": 6977,
"num_comments": 118,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkvlt",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "CarettaSquared",
"media": null,
"score": 1696,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/FI1_buO_wlWLAHUe.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 901,
"is_self": false,
"permalink": "/r/pics/comments/1mkvlt/shes_been_in_rehabilitation_for_the_last_four/",
"name": "t3_1mkvlt",
"created": 1379463179,
"url": "http://i.imgur.com/gSwVOI7.jpg",
"author_flair_text": null,
"title": "She's been in rehabilitation for the last four years after having half of her body crushed by a boat, but today she's going home!",
"created_utc": 1379434379,
"link_flair_text": null,
"ups": 2597,
"num_comments": 60,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkps5",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "ARM_Alaska",
"media": null,
"score": 2129,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/wPJR-QE0RVpZXAHc.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 1738,
"is_self": false,
"permalink": "/r/pics/comments/1mkps5/alaska_is_an_odd_place/",
"name": "t3_1mkps5",
"created": 1379458538,
"url": "http://imgur.com/bcTAEW4",
"author_flair_text": null,
"title": "Alaska is an odd place..",
"created_utc": 1379429738,
"link_flair_text": null,
"ups": 3867,
"num_comments": 73,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkjoo",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "ani625",
"media": null,
"score": 2735,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://b.thumbs.redditmedia.com/fSgs2_TGWjpM2NAy.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 6863,
"is_self": false,
"permalink": "/r/pics/comments/1mkjoo/band_of_brothers_where_are_they_now/",
"name": "t3_1mkjoo",
"created": 1379453019,
"url": "http://imgur.com/a/GBjC1",
"author_flair_text": null,
"title": "Band of Brothers: Where Are They Now?",
"created_utc": 1379424219,
"link_flair_text": null,
"ups": 9598,
"num_comments": 579,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkmm6",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "likwitsnake",
"media": null,
"score": 2278,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/l-H5SYlf2omIFAu5.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 2080,
"is_self": false,
"permalink": "/r/pics/comments/1mkmm6/sculptures_from_old_watch_part/",
"name": "t3_1mkmm6",
"created": 1379455847,
"url": "http://imgur.com/a/QIttE",
"author_flair_text": null,
"title": "Sculptures from old watch part",
"created_utc": 1379427047,
"link_flair_text": null,
"ups": 4358,
"num_comments": 42,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1ml7pt",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "Trubbles",
"media": null,
"score": 834,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/tQQip7tflCt_L4Zv.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 336,
"is_self": false,
"permalink": "/r/pics/comments/1ml7pt/no_one_believes_me_but_my_son_did_in_fact_hold/",
"name": "t3_1ml7pt",
"created": 1379472391,
"url": "http://i.imgur.com/OV2iA0W.jpg",
"author_flair_text": null,
"title": "No one believes me, but my son did in fact hold his head up less than 5 minutes after being born",
"created_utc": 1379443591,
"link_flair_text": null,
"ups": 1170,
"num_comments": 104,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkqf5",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "LifelessTomato",
"media": null,
"score": 1637,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/zibc3sqjfWPHPZwW.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 10271,
"is_self": false,
"permalink": "/r/pics/comments/1mkqf5/son_gives_his_dad_a_tattoo/",
"name": "t3_1mkqf5",
"created": 1379459032,
"url": "http://i.imgur.com/29F3Pkn.jpg",
"author_flair_text": null,
"title": "Son gives his dad a tattoo",
"created_utc": 1379430232,
"link_flair_text": null,
"ups": 11908,
"num_comments": 654,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "media-cache-ak0.pinimg.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mld91",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "inoor042",
"media": null,
"score": 613,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/kwHd2A436_X7qJFu.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 135,
"is_self": false,
"permalink": "/r/pics/comments/1mld91/adorable_baby_flamingo_its_the_first_time_i_have/",
"name": "t3_1mld91",
"created": 1379476502,
"url": "http://media-cache-ak0.pinimg.com/736x/28/47/3e/28473e8cfee884ac326025f762bc3f76.jpg",
"author_flair_text": null,
"title": "adorable baby flamingo. its the first time i have seen any baby flamingo pic",
"created_utc": 1379447702,
"link_flair_text": null,
"ups": 748,
"num_comments": 8,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkd7e",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "likk",
"media": null,
"score": 3034,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://b.thumbs.redditmedia.com/N8aGEV-juU7wrq2O.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 28903,
"is_self": false,
"permalink": "/r/pics/comments/1mkd7e/mended/",
"name": "t3_1mkd7e",
"created": 1379444924,
"url": "http://i.imgur.com/bjMr7am.jpg",
"author_flair_text": null,
"title": "Mended",
"created_utc": 1379416124,
"link_flair_text": null,
"ups": 31937,
"num_comments": 282,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mm542",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "Cunderthunt2113",
"media": null,
"score": 192,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/KCKuEjZirO7sLtdA.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 261,
"is_self": false,
"permalink": "/r/pics/comments/1mm542/i_made_a_promise_to_one_of_my_best_friend_since/",
"name": "t3_1mm542",
"created": 1379498030,
"url": "http://imgur.com/PY2EDsv",
"author_flair_text": null,
"title": "I made a promise to one of my best friend since middle school that when he returned home on leave from the marines, that we would go and get a beer together and catch up. He died today in a training accident. I held up to that promise.",
"created_utc": 1379469230,
"link_flair_text": null,
"ups": 453,
"num_comments": 47,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkr2k",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "robbiekhan",
"media": null,
"score": 1340,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://c.thumbs.redditmedia.com/sV2P2f618c5Ds2uh.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 718,
"is_self": false,
"permalink": "/r/pics/comments/1mkr2k/i_have_a_king_dick_heres_a_photo/",
"name": "t3_1mkr2k",
"created": 1379459575,
"url": "http://imgur.com/iWXBoLx",
"author_flair_text": null,
"title": "I have a king dick, here's a photo.",
"created_utc": 1379430775,
"link_flair_text": null,
"ups": 2058,
"num_comments": 53,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkogf",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "horse_you_rode_in_on",
"media": null,
"score": 1297,
"approved_by": null,
"over_18": true,
"hidden": false,
"thumbnail": "nsfw",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 958,
"is_self": false,
"permalink": "/r/pics/comments/1mkogf/disregard_the_constabulary/",
"name": "t3_1mkogf",
"created": 1379457388,
"url": "http://i.imgur.com/GJvjKDC.jpg",
"author_flair_text": null,
"title": "Disregard the constabulary",
"created_utc": 1379428588,
"link_flair_text": null,
"ups": 2255,
"num_comments": 87,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mm8q3",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "danthoms",
"media": null,
"score": 130,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://a.thumbs.redditmedia.com/Fg6cBx6muAmhmb4Z.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 28,
"is_self": false,
"permalink": "/r/pics/comments/1mm8q3/found_this_strange_book_in_a_storage_unit/",
"name": "t3_1mm8q3",
"created": 1379501042,
"url": "http://imgur.com/a/JX258",
"author_flair_text": null,
"title": "Found this Strange Book in a Storage Unit",
"created_utc": 1379472242,
"link_flair_text": null,
"ups": 158,
"num_comments": 45,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mm7ji",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "mikelem",
"media": null,
"score": 138,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "default",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 54,
"is_self": false,
"permalink": "/r/pics/comments/1mm7ji/my_oneyearold_went_to_the_zoo_yesterday_she_was/",
"name": "t3_1mm7ji",
"created": 1379500050,
"url": "http://imgur.com/qnuSkRG",
"author_flair_text": null,
"title": "My one-year-old went to the zoo yesterday. She was mesmerized.",
"created_utc": 1379471250,
"link_flair_text": null,
"ups": 192,
"num_comments": 16,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mm8dx",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "ujheisenburg94",
"media": null,
"score": 132,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/lJEjal9iVgCBR8dL.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 46,
"is_self": false,
"permalink": "/r/pics/comments/1mm8dx/should_i_invade_their_privacy/",
"name": "t3_1mm8dx",
"created": 1379500769,
"url": "http://i.imgur.com/rodPInM.jpg",
"author_flair_text": null,
"title": "Should I invade their privacy?",
"created_utc": 1379471969,
"link_flair_text": null,
"ups": 178,
"num_comments": 19,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlkg1",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "mrwhiskers123",
"media": null,
"score": 326,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://d.thumbs.redditmedia.com/JxDQ1SSN-NwZAv0W.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 87,
"is_self": false,
"permalink": "/r/pics/comments/1mlkg1/wire_art/",
"name": "t3_1mlkg1",
"created": 1379481656,
"url": "http://imgur.com/9AkxoMN",
"author_flair_text": null,
"title": "Wire art",
"created_utc": 1379452856,
"link_flair_text": null,
"ups": 413,
"num_comments": 8,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mkzrl",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "PlatinumAero",
"media": null,
"score": 681,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://f.thumbs.redditmedia.com/4kAYGRc_1JUoain_.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 233,
"is_self": false,
"permalink": "/r/pics/comments/1mkzrl/i_work_at_a_very_large_dealership_this_guy_just/",
"name": "t3_1mkzrl",
"created": 1379466328,
"url": "http://imgur.com/R9iap7F",
"author_flair_text": null,
"title": "I work at a very large dealership. This guy just drove in for a new tire.",
"created_utc": 1379437528,
"link_flair_text": null,
"ups": 914,
"num_comments": 128,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlevs",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "MikeDaBomb20",
"media": null,
"score": 376,
"approved_by": null,
"over_18": true,
"hidden": false,
"thumbnail": "nsfw",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 291,
"is_self": false,
"permalink": "/r/pics/comments/1mlevs/a_duck_charged_at_my_friends_moms_bike_it_did_not/",
"name": "t3_1mlevs",
"created": 1379477713,
"url": "http://i.imgur.com/sPuNQ2l.jpg",
"author_flair_text": null,
"title": "A duck charged at my friend's mom's bike. It did not end well for the duck.",
"created_utc": 1379448913,
"link_flair_text": null,
"ups": 667,
"num_comments": 60,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mk8q5",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "engti",
"media": null,
"score": 2784,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://c.thumbs.redditmedia.com/BVjl56VUl2jnFAE2.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 3937,
"is_self": false,
"permalink": "/r/pics/comments/1mk8q5/dinosaur_feather_with_a_mite_found_in_amber_from/",
"name": "t3_1mk8q5",
"created": 1379437191,
"url": "http://i.imgur.com/Fgi2NBK.jpg",
"author_flair_text": null,
"title": "Dinosaur feather, with a mite, found in amber from Canada",
"created_utc": 1379408391,
"link_flair_text": null,
"ups": 6721,
"num_comments": 234,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "flickr.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mlse7",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "Anthraxium",
"media": null,
"score": 203,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://e.thumbs.redditmedia.com/UMkhOJDQ_NL3hpzR.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 58,
"is_self": false,
"permalink": "/r/pics/comments/1mlse7/i_took_a_pic_of_a_fox_mic/",
"name": "t3_1mlse7",
"created": 1379487737,
"url": "http://www.flickr.com/photos/deadpixelphotos/9790800924/",
"author_flair_text": null,
"title": "I took a pic of a fox (MIC)",
"created_utc": 1379458937,
"link_flair_text": null,
"ups": 261,
"num_comments": 28,
"num_reports": null,
"distinguished": null
}
},
{
"kind": "t3",
"data": {
"domain": "imgur.com",
"banned_by": null,
"media_embed": {},
"subreddit": "pics",
"selftext_html": null,
"selftext": "",
"likes": null,
"secure_media": null,
"saved": false,
"id": "1mljab",
"secure_media_embed": {},
"clicked": false,
"stickied": false,
"author": "mrwhiskers123",
"media": null,
"score": 235,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "http://b.thumbs.redditmedia.com/xplx4kYtcPWJ-YW1.jpg",
"subreddit_id": "t5_2qh0u",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 78,
"is_self": false,
"permalink": "/r/pics/comments/1mljab/abandoned_yugoslavia_war_monument/",
"name": "t3_1mljab",
"created": 1379480761,
"url": "http://imgur.com/z6pzbyW",
"author_flair_text": null,
"title": "Abandoned Yugoslavia war monument",
"created_utc": 1379451961,
"link_flair_text": null,
"ups": 313,
"num_comments": 17,
"num_reports": null,
"distinguished": null
}
}
],
"after": "t3_1mljab",
"before": null
}
}
if(!d3.chart) d3.chart = {};
d3.chart.scatter = function() {
var g;
var data;
var width = 400;
var height = 400;
var cx = 10;
var numberBins = 5;
var dispatch = d3.dispatch(chart, "hover");
function chart(container) {
g = container;
g.append("g")
.classed("xaxis", true)
g.append("g")
.classed("yaxis", true)
update();
}
chart.update = update;
function update() {
var maxCreated = d3.max(data, function(d) { return d.data.created });
var minCreated = d3.min(data, function(d) { return d.data.created });
var maxScore = d3.max(data, function(d) { return d.data.score })
var colorScale = d3.scale.category20();
var createdScale = d3.time.scale()
.domain([minCreated, maxCreated])
.range([cx, width])
var commentScale = d3.scale.linear()
.domain(d3.extent(data, function(d) { return d.data.num_comments }))
.range([3, 15])
var yScale = d3.scale.linear()
.domain([0, maxScore])
.range([height, cx])
var xAxis = d3.svg.axis()
.scale(createdScale)
.ticks(3)
.tickFormat(d3.time.format("%x %H:%M"))
var yAxis = d3.svg.axis()
.scale(yScale)
.ticks(3)
.orient("left")
var xg = g.select(".xaxis")
.classed("axis", true)
.attr("transform", "translate(" + [0,height] + ")")
.transition()
.call(xAxis)
var yg = g.select(".yaxis")
.classed("axis", true)
.classed("yaxis", true)
.attr("transform", "translate(" + [cx - 5,0] + ")")
.transition()
.call(yAxis)
var circles = g.selectAll("circle")
.data(data, function(d) { return d.data.id })
circles.enter()
.append("circle")
circles
.transition()
.attr({
cx: function(d,i) { return createdScale(d.data.created) },
cy: function(d,i) { return yScale(d.data.score) },
r: function(d) { return commentScale(d.data.num_comments)}
})
circles.exit().remove()
circles.on("mouseover", function(d) {
d3.select(this).style("stroke", "black")
dispatch.hover([d])
})
circles.on("mouseout", function(d) {
d3.select(this).style("stroke", "")
dispatch.hover([])
})
var hist = d3.layout.histogram()
.value(function(d) { return d.data.score })
.range([0, d3.max(data, function(d){ return d.data.score }) ])
.bins(numberBins);
var layout = hist(data);
for(var i = 0; i < layout.length; i++) {
var bin = layout[i];
g.selectAll("circle")
.data(bin, function(d) { return d.data.id })
.style("fill", function() { return colorScale(i) })
}
}
chart.highlight = function(data) {
var circles = g.selectAll("circle")
.style("stroke", "")
circles.data(data, function(d) { return d.data.id })
.style("stroke", "orange")
.style("stroke-width", 3)
}
chart.data = function(value) {
if(!arguments.length) return data;
data = value;
return chart;
}
chart.width = function(value) {
if(!arguments.length) return width;
width = value;
return chart;
}
chart.height = function(value) {
if(!arguments.length) return height;
height = value;
return chart;
}
return d3.rebind(chart, dispatch, "on");
}
if(!d3.chart) d3.chart = {};
d3.chart.table = function() {
var div;
var data;
var width;
var dispatch = d3.dispatch(chart, "hover");
function chart(container) {
div = container;
var table = container.append("table")
update();
}
chart.update = update;
function update() {
var table = div.select("table")
var rows = table.selectAll("tr.row")
.data(data, function(d) { return d.data.id })
console.log("table data", data)
rows.exit().remove();
var rowsEnter = rows.enter()
.append("tr").classed("row", true)
rowsEnter.append("td")
.text(function(d) { return d.data.score })
rowsEnter.append("td")
.append("a")
.attr({
href: function(d) { return d.data.url }
})
.append("img")
.attr({
src: function(d) { return d.data.thumbnail }
})
rowsEnter.append("td")
.append("a")
.attr({
href: function(d) { return d.data.url }
}).text(function(d) { return d.data.title })
rowsEnter.append("td")
.text(function(d) { return d.data.ups })
rowsEnter.append("td")
.text(function(d) { return d.data.downs })
rowsEnter.on("mouseover", function(d) {
d3.select(this).style("background-color", "orange")
dispatch.hover([d])
})
rowsEnter.on("mouseout", function(d) {
d3.select(this).style("background-color", "")
dispatch.hover([])
})
}
chart.highlight = function(data) {
var trs = div.selectAll("tr")
.style("background-color", "")
trs.data(data, function(d) { return d.data.id })
.style("background-color", "orange")
}
chart.data = function(value) {
if(!arguments.length) return data;
data = value;
return chart;
}
chart.width = function(value) {
if(!arguments.length) return width;
width = value;
return chart;
}
return d3.rebind(chart, dispatch, "on");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment