Skip to content

Instantly share code, notes, and snippets.

@bessiec
Last active November 25, 2016 18:23
Show Gist options
  • Save bessiec/02a9636914f28a2bb230 to your computer and use it in GitHub Desktop.
Save bessiec/02a9636914f28a2bb230 to your computer and use it in GitHub Desktop.
NYCFC Shots v Shots-on-Goal Using DimpleJS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dimple/2.2.0/dimple.latest.js"></script>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
<style>
body {
font-family: Source Sans Pro;
margin-left: 5%;
}
</style>
</head>
<body>
<h1>NYCFC First Season Shots versus Shots on Goal Per Player</h1>
<h3>From <a href="http://www.nycfc.com/stats/season">NYCFC Stats</a></h3>
<script type="text/javascript">
function draw(data) {
var margin = 10,
width = 800 - margin,
height = 600 - margin;
var svg = d3.select("body")
.append("svg")
.attr("width", width + margin)
.attr("height", height + margin)
.append('g')
.attr('class', 'chart');
var Chart = new dimple.chart(svg, data);
var x = Chart.addMeasureAxis("x", "Shots")
Chart.addMeasureAxis("y", "Shots on Goal")
Chart.addSeries(["Player"], dimple.plot.scatter)
Chart.draw();
};
</script>
<script type="text/javascript">
d3.csv("nycfc.csv", draw)
</script>
</body>
</html>
Player Position GamesPlayed GamesStarted Minutes Goals Assists Shots Shots on Goal GameWinningGoals Penalty Kick Success Rate HomeGoal RoadGoal Goals90Minutes SC%
David Villa Forward 30 29 2514 18 8 138 64 6 0.88 11 7 0.64 13
Patrick Mullins Forward 24 11 1040 6 4 38 14 1 1.00 3 3 0.52 15.8
Thomas McNamara Midfielder 19 15 1324 5 3 23 12 1 0/0 4 1 0.34 21.7
Kwadwo Poku Midfielder 27 6 978 4 7 18 10 0 0/0 2 2 0.37 22.2
Mehdi Ballouchy Midfielder 19 16 1259 3 2 13 7 0 0/0 3 0 0.21 23.1
Frank Lampard Midfielder 10 9 733 3 1 27 4 1 0/0 1 2 0.37 11.1
Mix Diskerud Midfielder 27 23 2073 3 1 32 12 1 0/0 2 1 0.13 9.4
Ned Grabavoy Midfielder 26 22 1884 2 3 15 8 0 0/0 2 0 0.1 13.3
Andrew Jacobson Midfielder 33 33 2837 1 2 26 3 0 0/0 1 0 0.03 3.8
Khiry Shelton Forward 17 7 824 1 1 13 4 0 0/0 1 0 0.11 7.7
Kwame Watson-Siriboe Defender 11 7 687 1 0 3 1 0 0/0 0 1 0.13 33.3
Javier Calle Defender 12 7 542 1 0 12 4 0 0/0 1 0 0.17 8.3
Andrea Pirlo Midfielder 13 12 1074 0 5 20 3 0 0/0 0 0 0 0
Jose Angelino Tasende Defender 14 10 992 0 4 8 2 0 0/0 0 0 0 0
RJ Allen Defender 14 13 1054 0 2 4 1 0 0/0 0 0 0 0
Andoni Iraola Defender 9 8 759 0 1 3 0 0 0/0 0 0 0 0
Jeb Brovsky Defender 15 12 1132 0 1 11 1 0 0/0 0 0 0 0
Shay Facey Defender 23 20 1818 0 0 0 0 0 0/0 0 0 0 0
George John Defender 0 0 0 0 0 0 0 0 0/0 0 0 0 0
Connor Brandt Defender 1 0 9 0 0 0 0 0 0/0 0 0 0 0
Andres Mendoza Defender 0 0 0 0 0 0 0 0 0/0 0 0 0 0
Matthew Dunn Midfielder 1 0 52 0 0 0 0 0 0/0 0 0 0 0
Tony Taylor Forward 2 1 66 0 0 1 0 0 0/0 0 0 0 0
Josh Williams Defender 5 5 430 0 0 2 0 0 0/0 0 0 0 0
Jefferson Mena Defender 7 6 596 0 0 2 0 0 0/0 0 0 0 0
Jason Hernandez Defender 26 26 2294 0 0 3 0 0 0/0 0 0 0 0
Pablo �lvarez Midfielder 8 3 244 0 0 5 1 0 0/0 0 0 0 0
Chris Wingert Defender 27 26 2169 0 0 7 4 0 0/0 0 0 0 0
Sebasti�n Vel�squez Midfielder 12 5 446 0 0 9 2 0 0/0 0 0 0 0
Adam Nemec Forward 9 8 594 0 0 13 3 0 0/0 0 0 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment