Created
September 22, 2011 00:44
-
-
Save cpudney/1233755 to your computer and use it in GitHub Desktop.
Brownlow Medal Winners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name | Start | End | Medal1 | Votes1 | Club1 | Medal2 | Votes2 | Club2 | Medal3 | Votes3 | Club3 | Votes_pct | Career_games | Recruited_from | Career_details | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Edward 'Carji' Greeves, Jr. | 1923 | 1933 | 1924 | 7 | Geel | 38.8888888889 | 124 | Geelong College | Geel 1923-31; 1933 | |||||||
Colin Watson | 1920 | 1935 | 1925 | 9 | St K | 50 | 93 | South Warrnambool | St K 1920; 1922-25; 1933-35 | |||||||
Ivor Warne-Smith | 1919 | 1932 | 1926 | 9 | Melb | 1928 | 8 | Melb | 31.0606060606 | 146 | Wesley College | Melb 1919; 1925-32 | ||||
Syd Coventry | 1922 | 1934 | 1927 | 7 | Coll | 38.8888888889 | 227 | Diamond Creek | Coll 1922-34 | |||||||
Albert Collier | 1925 | 1942 | 1929 | 6 | Coll | 33.3333333333 | 217 | Ivanhoe | Coll 1925-30; 1933-39; Fitz 1941-42 | |||||||
Allan Hopkins | 1925 | 1934 | 1930 | 4 | Foots | 22.2222222222 | 151 | Footscray (VFA) | Foots 1925-34 | |||||||
Harry Collier | 1926 | 1940 | 1930 | 4 | Coll | 22.2222222222 | 253 | Ivanhoe | Coll 1926-40 | |||||||
Stan Judkins | 1928 | 1936 | 1930 | 4 | Rich | 22.2222222222 | 133 | Northcote (VFA) | Rich 1928-36 | |||||||
Haydn Bunton, Sr. | 1931 | 1942 | 1931 | 26 | Fitz | 1932 | 23 | Fitz | 1935 | 24 | Fitz | 45.0617283951 | 119 | West Albury (NSW) | Fitz 1931-37; 1942 | |
Wilfred 'Chicken' Smallhorn | 1930 | 1940 | 1933 | 18 | Fitz | 33.3333333333 | 150 | Brunswick Methodists | Fitz 1930-40 | |||||||
Dick Reynolds | 1933 | 1951 | 1934 | 19 | Ess | 1937 | 27 | Ess | 1938 | 18 | Ess | 39.5061728395 | 320 | Woodlands | Ess 1933-51 | |
Dinny' Ryan | 1935 | 1939 | 1936 | 26 | Fitz | 48.1481481481 | 70 | Albury (NSW) | Fitz 1935-39 | |||||||
Marcus Whelan | 1933 | 1947 | 1939 | 23 | Coll | 42.5925925926 | 173 | Darley | Coll 1933-42; 1946-47 | |||||||
Des Fothergill | 1937 | 1947 | 1940 | 32 | Coll | 59.2592592593 | 111 | Collingwood Tech | Coll 1937-40; 1945-47 | |||||||
Herbie Matthews | 1932 | 1945 | 1940 | 32 | S Melb | 59.2592592593 | 191 | Fairfield | S Melb 1932-45 | |||||||
Norman Ware | 1932 | 1946 | 1941 | 23 | Foots | 42.5925925926 | 200 | Sale | Foots 1932-42; 1944-46 | |||||||
Don Cordner | 1941 | 1950 | 1946 | 20 | Melb | 35.0877192982 | 166 | University | Melb 1941-50 | |||||||
Bert Deacon | 1942 | 1951 | 1947 | 23 | Carl | 40.350877193 | 106 | Preston (VFA) | Carl 1942-51 | |||||||
Bill Morris | 1942 | 1951 | 1948 | 24 | Rich | 42.1052631579 | 140 | Old Scotch | Rich 1942; 1944-51 | |||||||
Col Austen | 1940 | 1952 | 1949 | 23 | Haw | 40.350877193 | 142 | Kew | Haw 1940-43; 1946-49; Rich 1950-52 | |||||||
Ron Clegg | 1945 | 1960 | 1949 | 23 | S Melb | 40.350877193 | 231 | Melb Boys' Club | S Melb 1945-54; 1956-60 | |||||||
Allan Ruthven | 1940 | 1954 | 1950 | 21 | Fitz | 38.8888888889 | 222 | Ivanhoe | Fitz 1940-41; 1943-54 | |||||||
Bernie Smith | 1948 | 1958 | 1951 | 23 | Geel | 42.5925925926 | 183 | West Adelaide (SA) | Geel 1948-58 | |||||||
Bill Hutchison | 1942 | 1957 | 1952 | 21 | Ess | 1953 | 26 | Ess | 39.1414141414 | 290 | Essendon Stars | Ess 1942-57 | ||||
Roy Wright | 1946 | 1959 | 1952 | 21 | Rich | 1954 | 29 | Rich | 41.4141414141 | 195 | North Kew | Rich 1946-59 | ||||
Fred Goldsmith | 1951 | 1959 | 1955 | 21 | S Melb | 38.8888888889 | 119 | Williamstown (VFA) | S Melb 1951-59 | |||||||
Peter Box | 1951 | 1957 | 1956 | 22 | Foots | 40.7407407407 | 107 | Cheltenham | Foots 1951; 1953-57 | |||||||
Brian Gleeson | 1953 | 1957 | 1957 | 24 | St K | 44.4444444444 | 71 | Berrigan (NSW) | St K 1953-57 | |||||||
Neil Roberts | 1952 | 1962 | 1958 | 24 | St K | 44.4444444444 | 169 | MHSOB | St K 1952-62 | |||||||
Bob Skilton | 1956 | 1971 | 1959 | 20 | S Melb | 1963 | 20 | S Melb | 1968 | 24 | S Melb | 35.7800224467 | 238 | South Melb Fourths | S Melb 1956-68; 1970-71 | |
Verdun Howell | 1958 | 1968 | 1959 | 20 | St K | 37.037037037 | 159 | City Sth, Launceston | St K 1958-68 | |||||||
John Schultz | 1958 | 1968 | 1960 | 20 | Foots | 37.037037037 | 188 | Boort | Foots 1958-68 | |||||||
John James | 1953 | 1963 | 1961 | 21 | Carl | 38.8888888889 | 195 | St Patricks, Ballarat | Carl 1953-63 | |||||||
Alistair Lord | 1959 | 1966 | 1962 | 28 | Geel | 51.8518518519 | 122 | Cobden | Geel 1959-66 | |||||||
Gordon Collis | 1961 | 1967 | 1964 | 27 | Carl | 50 | 95 | Healesville | Carl 1961-65; 1967 | |||||||
Ian Stewart | 1963 | 1975 | 1965 | 20 | St K | 1966 | 21 | St K | 1971 | 21 | Rich | 33.5578002245 | 205 | Hobart | St K 1963-70; Rich 1971-75 | |
Noel Teasdale | 1956 | 1967 | 1965 | 20 | N Melb | 37.037037037 | 178 | Daylesford | N Melb 1956-67 | |||||||
Ross G. Smith | 1961 | 1975 | 1967 | 24 | St K | 44.4444444444 | 234 | Hampton Scouts | St K 1961-72; 1975 | |||||||
Kevin Murray | 1955 | 1974 | 1969 | 19 | Fitz | 31.6666666667 | 333 | Fitzroy Thirds | Fitz 1955-64; 1967-74 | |||||||
Peter Bedford | 1968 | 1978 | 1970 | 25 | S Melb | 37.8787878788 | 186 | Port Melbourne (VFA) | S Melb 1968-76; Carl 1977-78 | |||||||
Ian Stewart | 1963 | 1975 | 1971 | 21 | Rich | 31.8181818182 | 205 | Hobart (Tas) | St K 1963-70; Rich 1971-75 | |||||||
Len Thompson | 1965 | 1980 | 1972 | 25 | Coll | 37.8787878788 | 303 | Reservoir | Coll 1965-78; S Melb 1979; Fitz 1980 | |||||||
Keith Greig | 1971 | 1985 | 1973 | 27 | N Melb | 1974 | 27 | N Melb | 40.9090909091 | 297 | Brunswick (VFA) | N Melb 1971-85 | ||||
Gary Dempsey | 1967 | 1984 | 1975 | 20 | Foots | 30.303030303 | 329 | Footscray Tech OB | Foots 1967-78; N Melb 1979-84 | |||||||
Graham Moss | 1973 | 1976 | 1976 | 48 | Ess | 36.3636363636 | 84 | Claremont (WA) | Ess 1973-76 | |||||||
Graham Teasdale | 1973 | 1983 | 1977 | 59 | S Melb | 44.696969697 | 142 | Charlton | Rich 1973; S Melb 1975-81; Coll 1982-83 | |||||||
Malcolm Blight | 1974 | 1982 | 1978 | 22 | N Melb | 33.3333333333 | 178 | Woodville (SA) | N Melb 1974-82 | |||||||
Peter Moore | 1974 | 1987 | 1979 | 22 | Coll | 1984 | 24 | Melb | 34.8484848485 | 249 | Eltham | Coll 1974-82; Melb 1983-87 | ||||
Kelvin Templeton | 1974 | 1985 | 1980 | 23 | Foots | 34.8484848485 | 177 | Traralgon | Foots 1974-82; Melb 1983-85 | |||||||
Barry Round | 1969 | 1985 | 1981 | 22 | S Melb | 33.3333333333 | 328 | Warragul | Foots 1969-75; S Melb 1976-85 | |||||||
Bernie Quinlan | 1969 | 1986 | 1981 | 22 | Fitz | 33.3333333333 | 366 | Traralgon | Foots 1969-77; Fitz 1978-86 | |||||||
Brian Wilson | 1978 | 1991 | 1982 | 23 | Melb | 34.8484848485 | 209 | Braybrook | Foots 1978-79; N Melb 1980-81; Melb 1982-90; St K 1991 | |||||||
Ross Glendinning | 1978 | 1988 | 1983 | 24 | N Melb | 36.3636363636 | 230 | East Perth (WA) | N Melb 1978-86; WCE 1987-88 | |||||||
Brad Hardie | 1985 | 1992 | 1985 | 22 | Foots | 33.3333333333 | 150 | South Fremantle (WA) | Foots 1985-86; Bris 1987-91; Coll 1992 | |||||||
Greg Williams | 1984 | 1997 | 1986 | 17 | Syd | 1994 | 30 | Carl | 35.6060606061 | 259 | Golden Square | Geel 1984-85; Syd 1986-91; Carlt 1992-97 | ||||
Robert DiPierdomenico | 1975 | 1991 | 1986 | 17 | Haw | 25.7575757576 | 240 | North Kew | Haw 1975; 1978-91 | |||||||
John Platten | 1986 | 1997 | 1987 | 20 | Haw | 30.303030303 | 258 | Central District (SA) | Haw 1986-97 | |||||||
Tony Lockett | 1983 | 1999 | 1987 | 20 | St K | 30.303030303 | 281 | North Ballarat | St K 1983-94; Syd 1995-99 | |||||||
Gerard Healy | 1979 | 1990 | 1988 | 20 | Syd | 30.303030303 | 225 | Edithvale-Aspendale | Melb 1979-85; Syd 1986-90 | |||||||
Paul Couch | 1985 | 1997 | 1989 | 22 | Geel | 33.3333333333 | 259 | Warrnambool | Geel 1985-97 | |||||||
Tony Liberatore | 1986 | 2002 | 1990 | 18 | Foots | 27.2727272727 | 283 | Brunswick City | Foots 1986-2002 | |||||||
Jim Stynes | 1987 | 1998 | 1991 | 25 | Melb | 37.8787878788 | 264 | Ireland | Melb 1987-98 | |||||||
Scott Wynd | 1988 | 2001 | 1992 | 20 | Foots | 30.303030303 | 237 | Jacana | Foots 1988-2001 | |||||||
Gavin Wanganeen | 1991 | 2002 | 1993 | 18 | Ess | 30 | 300 | Port Adelaide (VFA) | Ess 1991-96; Port Ad 1997-2002 | |||||||
Paul Kelly | 1990 | 2002 | 1995 | 21 | Syd | 31.8181818182 | 234 | Wagga Tigers (NSW) | Syd 1990-2002 | |||||||
James Hird | 1992 | 2007 | 1996 | 21 | Ess | 31.8181818182 | 253 | Ainslie (ACT) | Ess 1992-2007 | |||||||
Michael Voss | 1992 | 2006 | 1996 | 21 | Bris | 31.8181818182 | 289 | Morningside (Qld) | Bris 1992-2006 | |||||||
Robert Harvey | 1988 | 2008 | 1997 | 26 | St K | 1998 | 32 | St K | 43.9393939394 | 383 | Seaford | St K 1988-2008 | ||||
Shane Crawford | 1993 | 2008 | 1999 | 28 | Haw | 42.4242424242 | 305 | Finley (NSW) | Haw 1993-2008 | |||||||
Shane Woewodin | 1997 | 2005 | 2000 | 24 | Melb | 36.3636363636 | 200 | East Fremantle (WA) | Melb 1997-2002, Coll 2003-2005 | |||||||
Jason Akermanis | 1995 | 2010 | 2001 | 23 | Bris | 34.8484848485 | 325 | Mayne (Qld) | Bris 1995-2006, WB 2007-2010 | |||||||
Simon Black | 1998 | 2013 | 2002 | 25 | Bris | 37.8787878788 | 322 | East Fremantle (WA) | Bris 1998-2013 | |||||||
Adam Goodes | 1999 | 2003 | 22 | Syd | 2006 | 22 | Syd | 33.3333333333 | 331 | Horsham/North Ballarat U18 | Syd 1999- | |||||
Mark Ricciuto | 1993 | 2007 | 2003 | 22 | Adel | 33.3333333333 | 312 | West Adelaide (SA) | Adel 1993-2007 | |||||||
Nathan Buckley | 1993 | 2007 | 2003 | 22 | Coll | 33.3333333333 | 280 | Southern Districts (Port Adelaide) | Bris 1993; Coll 1994-2007 | |||||||
Chris Judd | 2002 | 2004 | 30 | WCE | 2010 | 30 | Carl | 45.4545454545 | 259 | Caulfield Grammar/Sandringham U18 | WCE 2002-2007, Carl 2008- | |||||
Ben Cousins | 1996 | 2010 | 2005 | 20 | WCE | 30.303030303 | 270 | East Fremantle | WCE 1996-2007, Rich 2009 -2010 | |||||||
Jimmy Bartel | 2002 | 2007 | 29 | Geel | 43.9393939394 | 249 | Bell Park/Geelong U18 | Geel 2002- | ||||||||
Adam Cooney | 2004 | 2008 | 24 | WB | 36.3636363636 | 201 | West Adelaide (SANFL) | WB 2004- | ||||||||
Gary Ablett, Jr. | 2002 | 2009 | 30 | Geel | 2013 | 28 | GCS | 30.21212121212 | 253 | Geelong U18 | Geel 2002- 2010, GCS 2011- | |||||
Dane Swan | 2003 | 2011 | 34 | Coll | 51.5151515152 | 219 | Calder Cannons | Coll 2003- | ||||||||
Jobe Watson | 2003 | 2012 | 30 | Ess | 45.4545454545 | 173 | Sandringham Dragons | Ess 2003- | ||||||||
Matt Priddis | 2006 | 2013 | 26 | WCE | 39.3939393939 | 173 | Subiaco Lions | WCE 2006- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Brownlow Medal Winners</title> | |
<meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?1.29.1"></script> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
padding: 0; | |
background-color: #ffffff; | |
font-family: sans-serif; | |
font-size: 12px; | |
color: #666666; | |
overflow: hidden; | |
} | |
.vis { | |
background: #ffffff; | |
border: none; | |
shape-rendering: crispEdges; | |
} | |
rect.background { | |
fill: #ffffff; | |
} | |
rect.bar { | |
stroke: #999999; | |
fill: #3366cc; | |
fill-opacity: 0.75; | |
} | |
g.barGroup:hover rect.bar { | |
fill-opacity: 1; | |
} | |
text { | |
font-family: sans-serif; | |
font-size: 9px; | |
fill: #3366cc; | |
} | |
text.rule { | |
fill: #999999; | |
} | |
line.medalLine { | |
stroke: #ffff00; | |
stroke-width: 1px; | |
} | |
line.tickLine { | |
stroke: #999999; | |
} | |
#controls { | |
padding: 10px; | |
text-align: center; | |
} | |
a { | |
color: #003399; | |
cursor: pointer; | |
text-decoration: none; | |
} | |
a.active { | |
color: #6699ff; | |
} | |
#infobox { | |
position: absolute; | |
width: auto; | |
height: auto; | |
padding: 8px; | |
display: none; | |
background: #cccccc; | |
color: #333333; | |
} | |
.title { | |
color: #000000; | |
font-weight: bold; | |
} | |
</style> | |
<script type="text/javascript"> | |
var visWidth, visHeight; | |
var transitionDuration = 800; | |
var data = []; | |
var scales = {}; | |
var totals = {}; | |
var currentYear = new Date().getFullYear(); | |
var vis; | |
var padding = { top: 40, right: 140, bottom: 30, left: 30 }; | |
var barHeight = 10; | |
var controls = { | |
display: "aligned", | |
height: "fixed" | |
}; | |
$(document).ready(function() { | |
// Create and append the visualization SVG block. | |
vis = d3.select("body").append("svg:svg").attr("class", "vis") | |
// Set dimensions according to window size. | |
setVisSize(); | |
// Read the data set. | |
d3.csv("brownlow.csv", function(d) { | |
data = d; | |
// Process each row. | |
for (i = 0; | |
i < data.length; | |
i++) { | |
var row = data[i]; | |
// Process each column. | |
for (prop in row) { | |
// Parse numbers and Booleans. | |
if (!isNaN(row[prop])) { | |
row[prop] = parseFloat(row[prop]); | |
} else if (row[prop] == "Yes") { | |
row[prop] = true; | |
} else if (row[prop] == "No") { | |
row[prop] = false; | |
} | |
} | |
// Retired? | |
if (isNaN(row.End)) row.End = currentYear; | |
row.Retired = row.End != currentYear; | |
// Calculate career span. | |
row.Span = row.End - row.Start; | |
} | |
// Sort on medal year. | |
data.sort(function(a, b) { | |
return d3.ascending(a.Medal1, b.Medal1); | |
}); | |
// Calculate totals. | |
totals.games = d3.sum(data, function(d) { | |
return d.Career_games; | |
}); | |
totals.votes = d3.sum(data, function(d) { | |
return d.Votes_pct; | |
}); | |
// Determine scales etc. | |
processData(); | |
// Render visualization. | |
drawVis(); | |
// Handle user interaction. | |
addInteractionEvents(); | |
// Initialize controls after a delay. | |
setTimeout(function() { | |
setControl($("#controls #layoutControls #layout-timeline"), "display", "timeline", false); | |
setControl($("#controls #heightControls #height-games"), "height", "games", true); | |
}, 500); | |
}); | |
}); | |
// Set width and height of the visualization according to parent window size. | |
function setVisSize() { | |
visWidth = $(window).width() - 4; | |
visHeight = $(window).height() - 25 - $("#controls").height(); | |
vis.attr("width", visWidth).attr("height", visHeight); | |
vis.select("rect").attr("width", visWidth).attr("height", visHeight); | |
} | |
// TODO: This isn't working properly | |
// Handle resize event. | |
//$(window).resize(function() { | |
// setVisSize(); | |
// processData(); | |
// redraw(); | |
//}); | |
// Process the data set. | |
function processData() { | |
// Bar height. | |
var totalHeight = visHeight - padding.top - padding.bottom; | |
barHeight = totalHeight / data.length; | |
// Years scale. | |
scales.years = d3.scale.linear(). | |
domain([ d3.min(data, function(d) { | |
return d.Start; | |
}), d3.max(data, function(d) { | |
return d.End; | |
}) ]) | |
.range([ padding.left, visWidth - padding.right ]); | |
// Player indices scale. | |
scales.indexes = d3.scale.linear() | |
.domain([ 0, data.length - 1 ]) | |
.range([ padding.top, visHeight - padding.bottom - barHeight ]); | |
// Games played scale. | |
scales.games = function(a) { | |
return totalHeight * (a / totals.games); | |
}; | |
// Votes scale. | |
scales.votes = function(a) { | |
return totalHeight * (a / totals.votes); | |
}; | |
// Y-coordinate for games scaling. | |
var gamesY = padding.top; | |
for (i = 0; i < data.length; i++) { | |
d = data[i]; | |
d.games_y = gamesY; | |
gamesY += scales.games(d.Career_games); | |
} | |
// Y-coordinate for votes scaling. | |
var votesY = padding.top; | |
for (i = 0; i < data.length; i++) { | |
d = data[i]; | |
d.votes_y = votesY; | |
votesY += scales.votes(d.Votes_pct); | |
} | |
} | |
// Render the visualization. | |
function drawVis() { | |
// Parent SVG background rectangle. | |
vis.append("svg:rect") | |
.attr("class", "background") | |
.attr("x", 0) | |
.attr("y", 0) | |
.attr("width", visWidth) | |
.attr("height", visHeight); | |
// Year tick-lines. | |
vis.selectAll("line") | |
.data(scales.years.ticks(10)) | |
.enter().append("svg:line") | |
.attr("class", "tickLine") | |
.attr("x1", padding.left) | |
.attr("x2", padding.left) | |
.attr("y1", padding.top) | |
.attr("y2", visHeight - padding.bottom); | |
// Year tick labels. | |
vis.selectAll("text.rule") | |
.data(scales.years.ticks(10)) | |
.enter().append("svg:text") | |
.attr("class", "rule") | |
.attr("x", padding.left) | |
.attr("y", 20) | |
.attr("dy", 0) | |
.attr("text-anchor", "middle") | |
.text(function(d) { | |
return d; | |
}); | |
// Player containers. | |
vis.selectAll("g") | |
.data(data) | |
.enter().append("svg:g") | |
.attr("class", "barGroup") | |
.attr("index", function(d, i) { | |
return i; | |
}) | |
.attr("transform", function(d, i) { | |
return "translate(" + padding.left + ", " + scales.indexes(i) + ")"; | |
}); | |
// Player bars. | |
vis.selectAll("g.barGroup") | |
.append("svg:rect") | |
.attr("class", "bar") | |
.attr("x", 0) | |
.attr("y", 0) | |
.attr("width", function(d) { | |
return scales.years(d.End) - scales.years(d.Start); | |
}) | |
.attr("height", barHeight); | |
// Medal marks. | |
for (medal in {Medal1: '', Medal2: '', Medal3: ''}) { | |
vis.selectAll("g.barGroup") | |
.append("svg:line") | |
.attr("class", "medalLine") | |
.attr("x1", function(d) { | |
return isNaN(d[medal]) ? 0 : scales.years(d[medal]) - scales.years(d.Start); | |
}) | |
.attr("x2", function(d) { | |
return isNaN(d[medal]) ? 0 : scales.years(d[medal]) - scales.years(d.Start); | |
}) | |
.attr("y1", 0) | |
.attr("y2", barHeight) | |
.style("visibility", function(d) { | |
return isNaN(d[medal]) ? "hidden" : "visible"; | |
} | |
); | |
} | |
// Player name labels. | |
vis.selectAll("g.barGroup") | |
.append("svg:text") | |
.attr("class", "barLabel") | |
.attr("x", function(d) { | |
return scales.years(d.End) - scales.years(d.Start); | |
}) | |
.attr("y", 0) | |
.attr("dx", 5) | |
.attr("dy", ".35em") | |
.style("font-weight", function(d) { | |
return d.Retired ? "normal" : "bold"; | |
}) | |
.text(function(d) { | |
return d.Name; | |
}); | |
} | |
// Redraw with transitions. | |
function redraw() { | |
// Hide the information box. | |
$("#infobox").hide(); | |
// Determine the centre. | |
var visCenter = (visWidth - padding.left - padding.right) / 2 + padding.left; | |
// Year tick-lines. | |
vis.selectAll("line.tickLine") | |
.transition() | |
.duration(transitionDuration) | |
.attr("x1", function(d, i) { | |
if (controls.display == "timeline") return scales.years(d); | |
else if (controls.display == "centered") return visCenter; | |
else return padding.left; | |
}) | |
.attr("x2", function(d) { | |
if (controls.display == "timeline") return scales.years(d); | |
else if (controls.display == "centered") return visCenter; | |
else return padding.left; | |
}) | |
.attr("y1", padding.top) | |
.attr("y2", visHeight - padding.bottom); | |
// Year tick labels. | |
vis.selectAll("text.rule") | |
.transition() | |
.duration(transitionDuration) | |
.attr("x", function(d) { | |
if (controls.display == "timeline") return scales.years(d); | |
else if (controls.display == "centered") return visCenter; | |
else return padding.left; | |
}) | |
.attr("y", 20) | |
.attr("dy", 0); | |
// Player containers. | |
vis.selectAll("g") | |
.transition() | |
.duration(transitionDuration) | |
.style("fill-opacity", function(d) { | |
return 1; | |
}) | |
.attr("transform", function(d, i) { | |
var tx, ty; | |
if (controls.display == "timeline") tx = scales.years(d.Start); | |
else if (controls.display == "centered") tx = visCenter - (scales.years(d.Medal1) - scales.years(d.Start)); | |
else tx = padding.left; | |
if (controls.height == "games") ty = d.games_y; | |
else if (controls.height == "votes") ty = d.votes_y; | |
else ty = scales.indexes(i); | |
return "translate(" + tx + ", " + ty + ")"; | |
}); | |
// Player bars. | |
vis.selectAll("g.barGroup rect.bar") | |
.transition() | |
.duration(transitionDuration) | |
.style("fill-opacity", function(d) { | |
return .75; | |
}) | |
.attr("height", function(d) { | |
if (controls.height == "games") return scales.games(d.Career_games); | |
else if (controls.height == "votes") return scales.votes(d.Votes_pct); | |
else return barHeight; | |
}); | |
// Player name labels. | |
var labelHeight = 0; | |
vis.selectAll("g.barGroup text.barLabel") | |
.transition() | |
.duration(transitionDuration) | |
.attr("y", function(d) { | |
if (controls.height == "games") return scales.games(d.Career_games) / 2 - labelHeight; | |
else if (controls.height == "votes") return scales.votes(d.Votes_pct) / 2 - labelHeight; | |
else return barHeight / 2 - labelHeight; | |
}); | |
// Medal marks. | |
vis.selectAll("g.barGroup line.medalLine") | |
.transition() | |
.duration(transitionDuration) | |
.attr("y2", function(d) { | |
if (controls.height == "games") return scales.games(d.Career_games); | |
else if (controls.height == "votes") return scales.votes(d.Votes_pct); | |
else return barHeight; | |
}); | |
} | |
// Add interaction event handlers. | |
function addInteractionEvents() { | |
// Show the information box on bar clicks. | |
$("g.barGroup").click( | |
function(e) { | |
showInfoBox(e, $(this).attr("index")); | |
} | |
); | |
// Hide the information box on background clicks. | |
$("rect.background").click(function(e) { | |
showInfoBox(e, null); | |
}); | |
} | |
// Display the information box for event (e) and player index (i). | |
function showInfoBox(e, i) { | |
if (i == null) { | |
$("#infobox").hide(); | |
} | |
else { | |
// Get the clicked player's data. | |
var d = data[i]; | |
// Construct player information text. | |
var info = "<span class='title'>" + d.Name + "</span>" | |
+ "<br />Brownlow Medal <br /> " | |
+ d.Medal1 + " (" + d.Club1 + "; " + d.Votes1 + " votes)"; | |
if (!isNaN(d.Medal2)) { | |
info += "<br /> " + d.Medal2 + " (" + d.Club2 + "; " + d.Votes2 + " votes)"; | |
} | |
if (!isNaN(d.Medal3)) { | |
info += "<br /> " + d.Medal3 + " (" + d.Club3 + "; " + d.Votes3 + " votes)"; | |
} | |
info += "<br /> " + d.Votes_pct.toFixed(2) + "% of votes" | |
+ "<br />Career: " + d.Career_details + " (" + d.Career_games + " games)" | |
+ "<br />Recruited from: " + d.Recruited_from; | |
// Position the information box. | |
var infoPos = { | |
left: e.pageX < visWidth / 2 ? e.pageX : e.pageX - 200 , | |
top: e.pageY < visHeight / 2 ? e.pageY : e.pageY - 80 | |
}; | |
// Show the information box. | |
$("#infobox") | |
.html(info) | |
.css(infoPos) | |
.show(); | |
} | |
} | |
// Set control elements. | |
function setControl(elem, con, val, re) { | |
// Clear inactive control element, set active element. | |
$(elem).parents(".controlGroup").find("a").removeClass("active"); | |
$(elem).addClass("active"); | |
controls[con] = val; | |
// Redraw if necessary. | |
if (re) { | |
redraw(); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div id="controls"> | |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> | |
<tr> | |
<td align="left"> | |
<span class="title">Brownlow Medal Winners</span> | |
</td> | |
<td align="center" style="padding: 0 20px"> | |
<span id="layoutControls" class="controlGroup">Position: | |
<a id="layout-timespan" class="active" | |
title="Bars aligned at the starts of players' careers" | |
onclick="javascript:setControl(this, 'display', 'aligned', true); return false;">Careers</a> | | |
<a id="layout-timeline" | |
title="Bars arranged chronologically" | |
onclick="javascript:setControl(this, 'display', 'timeline', true); return false;">Timeline</a> | | |
<a id="layout-medals" | |
title="Bars aligned by (first) Brownlow Medal winning years" | |
onclick="javascript:setControl(this, 'display', 'centered', true); return false;">Medals</a> | |
</span> | |
| |
<span id="heightControls" class="controlGroup">Height: | |
<a id="height-fixed" class="active" | |
title="Equal height bars for all players" | |
onclick="javascript:setControl(this, 'height', 'fixed', true); return false;">Fixed</a> | | |
<a id="height-games" | |
title="Bar heights scaled by the numbers of AFL/VFL games played" | |
onclick="javascript:setControl(this, 'height', 'games', true); return false;">Games</a> | | |
<a id="height-votes" | |
title="Bar heights scaled by the number of medal-winning votes as a percentage of maximum votes possible" | |
onclick="javascript:setControl(this, 'height', 'votes', true); return false;">Votes %</a> | |
</span> | |
</td> | |
<td align="right"> | |
By <a href="http://vislives.com" target="_blank">Chris Pudney</a> | |
<a href="http://creativecommons.org/licenses/by-sa/3.0/"><img align="top" alt="Creative Commons License" | |
src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"/></a> | |
Data from <a | |
href="http://www.afl.com.au/aflhq/awards/brownlow/thehonourroll/tabid/854/default.aspx">AFL.com.au</a> | |
& <a href="https://secure.wikimedia.org/wikipedia/en/wiki/List_of_Brownlow_Medal_winners" | |
target="_blank">Wikipedia</a>. | |
</td> | |
</tr> | |
</table> | |
</div> | |
<div id="infobox"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix resize | |
Possibly add +1 to End year and 0.5 to medal years | |
Add year of birth and death | |
Colour medal lines (by team), player bar/name (by state of origin) | |
Add player URL and image URL to spreadsheet and infobox |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment