Skip to content

Instantly share code, notes, and snippets.

@jzgit
Created October 17, 2013 23:04
Show Gist options
  • Save jzgit/7033873 to your computer and use it in GitHub Desktop.
Save jzgit/7033873 to your computer and use it in GitHub Desktop.
picks
{"description":"picks","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"main.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/Y4IzEhq.png"}
// last stompy33
var margin = {top: 100, right: 100, bottom: 100, left: 10},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var svg = d3.select('svg')
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom);
var data = [-20, -5, 0, 10, 28, 39];
var reddit = [
{name: 'silentlamp', prediction: -30, tie: 18},
{name: 'airkalen', prediction: -44, tie: 10},
{name: 'maurosmane', prediction: 127, tie: 18},
{name: 'DingDingDao', prediction: 116, tie: 10},
{name: 'waitforiiiit', prediction: 130, tie: 27},
{name: 'my79spirit', prediction: 127, tie: 12},
{name: 'reddit2therescue', prediction: 199, tie: 28},
{name: 'small_sandwich', prediction: 89, tie: 6},
{name: 'nova62', prediction: 160, tie: 17},
{name: 'Th595906', prediction: -42, tie: 9},
{name: 'sisyphuscomplex', prediction: 95, tie: 17},
{name: 'stengebt', prediction: 75, tie: 8},
{name: 'diggmedown', prediction: 123, tie: 0},
{name: 'XboxChunkyTaco', prediction: 88, tie: 7},
{name: 'dgapinski', prediction: 80, tie: 17},
{name: 'snoogans235', prediction: 151, tie: 18},
{name: 'Thinandbony', prediction: 213, tie: 17},
{name: 'Bronco_Ent', prediction: 62, tie: 26},
{name: 'DominizZzle', prediction: 52, tie: 18},
{name: 'wolfsclothing', prediction: 70, tie: 14},
{name: 'KimonoThief', prediction: 206, tie: 17},
{name: 'Mark_B123', prediction: 154, tie: 25},
{name: 'Darth_Turtle', prediction: 135, tie: 14},
{name: 'drocks27', prediction: 139, tie: 8},
{name: 'samkoebrich', prediction: 148, tie: 17},
{name: 'Hawk_Biz', prediction: 163, tie: 13},
{name: 'z-tabris', prediction: 163, tie: 22},
{name: 'douglyfe', prediction: 60, tie: 3},
{name: 'Imperium_VII', prediction: 90, tie: 17},
{name: 'dryholeclause', prediction: 200, tie: 17},
{name: 'creepykirk', prediction: 144, tie: 24},
{name: 'drgonzo80', prediction: 98, tie: 10},
{name: 'MickyykciM', prediction: -75, tie: 21},
{name: 'H-bizzle', prediction: 50, tie: 14},
{name: 'tnick771', prediction: 85, tie: 24},
{name: 'God_Man', prediction: 150, tie: 14},
{name: 'mickey2k', prediction: 35, tie: 17},
{name: 'minimegacar', prediction: 97, tie: 21},
{name: 'Standgeblasen', prediction: 33, tie: 8},
{name: 'Saccborg', prediction: 159, tie: 12},
{name: 'LtJimmyCross', prediction: -22, tie: 15},
{name: 'TheClayroo', prediction: 85, tie: 17},
{name: 'Midnight06', prediction: 164, tie: 10},
{name: 'Sir_Mopalot', prediction: 30, tie: 15},
{name: 'lusiris', prediction: 163, tie: 21},
{name: 'Simpsaholic', prediction: 57, tie: 13},
{name: 'baron32191', prediction: -70, tie: 13},
{name: 'TwinkleTwinkleBaby', prediction: 160, tie: 13},
{name: 'meztastic', prediction: -87, tie: 13},
{name: 'AdaAstra', prediction: 147, tie: 17},
{name: 'jamessnow', prediction: -29, tie: 14},
{name: 'nalarsen', prediction: 65, tie: 15},
{name: 'ThorTheTechnoViking', prediction: 97, tie: 14},
{name: 'Bradyta', prediction: 50, tie: 18},
{name: 'notshawnvaughn', prediction: 67, tie: 10},
{name: 'johnsmith00000', prediction: 100, tie: 24},
{name: 'TDenverFan', prediction: 65, tie: 8},
{name: 'AlrightStopHammatime', prediction: 27, tie: 14},
{name: 'LSUrockhound', prediction: 110, tie: 4},
{name: 'Matthew5-30', prediction: 60, tie: -13},
{name: 'stompy33', prediction: -86, tie: 14}
];
var minPrediction = d3.min(data);
var maxPrediction = d3.max(data);
var xScale = d3.scale.linear()
.domain([minPrediction, maxPrediction])
.range([margin.left, width - margin.right]);
var xAxis = d3.svg.axis()
.scale(xScale)
.ticks(6)
.orient('bottom');
var g = svg.append('g')
.attr({
width: 100,
height: 200
});
g.attr("transform", function(d) {
return "translate(" + [20, 20] + ")";
});
var predictions = g.selectAll('rect')
.data(data)
.enter()
.append('rect')
.attr({
height: 30,
width: 2,
x: function(d) {return xScale(d)},
y: 8
});
svg.append('g')
.classed('axis', true)
.attr("transform", "translate(" + [margin.left, height] + ")")
.call(xAxis);
.axis path,
.axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
.axis text {
font-family: sans-serif;
font-size: 11px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment