Skip to content

Commit

Permalink
fixed up data for two stories
Browse files Browse the repository at this point in the history
  • Loading branch information
emro committed Jul 24, 2017
1 parent e67dd73 commit dc77d6c
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 44 deletions.
2 changes: 1 addition & 1 deletion data/allStravaSplits.csv
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ Lauren Elkins,10:53,5
Lauren Elkins,10:23,4
Lauren Elkins,10:50,3
Lauren Elkins,10:00,2
Lauren Elkins,9:48,1
Lauren Elkins,9:48,1
131 changes: 131 additions & 0 deletions data/raceSplits.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
athlete_id,pace,mile
Greg McQuaid,9:15,1
Greg McQuaid,8:48,2
Greg McQuaid,9:39,3
Greg McQuaid,9:24,4
Greg McQuaid,9:32,5
Greg McQuaid,10:25,6
Greg McQuaid,9:42,7
Greg McQuaid,9:51,8
Greg McQuaid,9:36,9
Greg McQuaid,9:25,10
Greg McQuaid,9:54,11
Greg McQuaid,9:46,12
Greg McQuaid,9:42,13
Greg McQuaid,8:45,14
Greg McQuaid,8:50,15
Greg McQuaid,10:06,16
Greg McQuaid,10:11,17
Greg McQuaid,9:58,18
Greg McQuaid,9:30,19
Greg McQuaid,9:41,20
Greg McQuaid,8:44,21
Greg McQuaid,9:09,22
Greg McQuaid,9:15,23
Greg McQuaid,8:25,24
Greg McQuaid,8:09,25
Greg McQuaid,8:46,26
Jorge Maravilla,5:44,1
Jorge Maravilla,5:53,2
Jorge Maravilla,5:40,3
Jorge Maravilla,5:42,4
Jorge Maravilla,5:42,5
Jorge Maravilla,5:55,6
Jorge Maravilla,5:19,7
Jorge Maravilla,5:26,8
Jorge Maravilla,5:34,9
Jorge Maravilla,5:37,10
Jorge Maravilla,5:02,11
Jorge Maravilla,5:53,12
Jorge Maravilla,5:41,13
Jorge Maravilla,5:24,14
Jorge Maravilla,5:37,15
Jorge Maravilla,5:46,16
Jorge Maravilla,5:46,17
Jorge Maravilla,5:23,18
Jorge Maravilla,5:30,19
Jorge Maravilla,5:25,20
Jorge Maravilla,5:10,21
Jorge Maravilla,5:12,22
Jorge Maravilla,5:39,23
Jorge Maravilla,5:33,24
Jorge Maravilla,5:29,25
Jorge Maravilla,5:46,26
Hilary Shirazi,8:02,1
Hilary Shirazi,7:49,2
Hilary Shirazi,7:47,3
Hilary Shirazi,7:37,4
Hilary Shirazi,7:50,5
Hilary Shirazi,8:49,6
Hilary Shirazi,7:42,7
Hilary Shirazi,7:48,8
Hilary Shirazi,7:57,9
Hilary Shirazi,8:12,10
Hilary Shirazi,7:37,11
Hilary Shirazi,8:11,12
Hilary Shirazi,7:56,13
Hilary Shirazi,7:56,14
Hilary Shirazi,8:05,15
Hilary Shirazi,8:18,16
Hilary Shirazi,8:59,17
Hilary Shirazi,7:51,18
Hilary Shirazi,8:05,19
Hilary Shirazi,8:06,20
Hilary Shirazi,7:43,21
Hilary Shirazi,7:47,22
Hilary Shirazi,8:24,23
Hilary Shirazi,8:14,24
Hilary Shirazi,8:01,25
Hilary Shirazi,8:07,26
Iain Mickle,6:46,1
Iain Mickle,6:40,2
Iain Mickle,6:41,3
Iain Mickle,6:34,4
Iain Mickle,6:35,5
Iain Mickle,7:26,6
Iain Mickle,6:34,7
Iain Mickle,6:37,8
Iain Mickle,6:46,9
Iain Mickle,7:02,10
Iain Mickle,6:27,11
Iain Mickle,7:09,12
Iain Mickle,6:56,13
Iain Mickle,6:38,14
Iain Mickle,6:55,15
Iain Mickle,6:51,16
Iain Mickle,6:52,17
Iain Mickle,6:29,18
Iain Mickle,6:30,19
Iain Mickle,6:40,20
Iain Mickle,6:18,21
Iain Mickle,6:32,22
Iain Mickle,6:44,23
Iain Mickle,6:50,24
Iain Mickle,6:38,25
Iain Mickle,6:51,26
Balint Gal,8:49,1
Balint Gal,8:59,2
Balint Gal,9:00,3
Balint Gal,8:56,4
Balint Gal,8:49,5
Balint Gal,9:34,6
Balint Gal,8:32,7
Balint Gal,8:31,8
Balint Gal,8:46,9
Balint Gal,8:44,10
Balint Gal,8:17,11
Balint Gal,9:08,12
Balint Gal,8:42,13
Balint Gal,8:34,14
Balint Gal,9:16,15
Balint Gal,9:09,16
Balint Gal,9:07,17
Balint Gal,8:42,18
Balint Gal,8:37,19
Balint Gal,8:41,20
Balint Gal,8:23,21
Balint Gal,8:32,22
Balint Gal,8:51,23
Balint Gal,8:49,24
Balint Gal,8:24,25
Balint Gal,8:44,26
16 changes: 16 additions & 0 deletions src/css/project.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ a {
}
}

.landing-image {
max-width: 1000px;
margin: auto;
padding: 0;
img {
width: 100%;
}
}

.gif-container {
max-width: 800px;
margin: auto;
Expand Down Expand Up @@ -227,6 +236,9 @@ a {
&.nomargin {
margin: 0 auto 20px auto;
}
&.narrow {
max-width: 800px;
}
}

.text-pullout {
Expand All @@ -241,6 +253,10 @@ a {
&.padded {
margin-bottom: 40px;
}
&.centered {
max-width: 600px;
margin: 20px auto;
}
//
@media @mobile {
width: 90%;
Expand Down
3 changes: 3 additions & 0 deletions src/css/sfchronicle.less
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ header {
&.landing {
margin-bottom: 2.5em;
}
&.top {
margin-top: 0;
}
}

.byline {
Expand Down
34 changes: 17 additions & 17 deletions src/js/races.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ function hoverChart(targetID,maxval,yLabel,units,runnerID) {
};
if (screen.width > 768) {
// var width = 440 - margin.left - margin.right;
var height = 450 - margin.top - margin.bottom;
var height = 500 - margin.top - margin.bottom;
} else if (screen.width <= 768 && screen.width > 480) {
// var width = 440 - margin.left - margin.right;
var height = 450 - margin.top - margin.bottom;
var height = 500 - margin.top - margin.bottom;
} else if (screen.width <= 480 && screen.width > 340) {
console.log("big phone");
var margin = {
Expand Down Expand Up @@ -217,20 +217,20 @@ function hoverChart(targetID,maxval,yLabel,units,runnerID) {
var voronoi = d3.voronoi()
// .curve(d3.curveBasis)
.x(function(d) {
return x(d["mileShort"]);
return x(d["mile"]);
})
.y(function(d) {
return y(parsePace(d["paceShort"]))
return y(parsePace(d["pace"]))
})
.extent([[-margin.left, -margin.top], [width + margin.right, height + margin.bottom]]);

var line = d3.line()
.curve(d3.curveCardinal)
.x(function(d) {
return x(d["mileShort"]);
return x(d["mile"]);
})
.y(function(d) {
return y(parsePace(d["paceShort"]));
return y(parsePace(d["pace"]));
});

var elevationLine = d3.line()
Expand Down Expand Up @@ -281,8 +281,8 @@ function hoverChart(targetID,maxval,yLabel,units,runnerID) {
function mouseover(d) {
d3.select(".id"+d.data.athlete_id.toLowerCase().replace(/ /g,'')+runnerID.toLowerCase().replace(/ /g,'')).classed("line-hover-races", true);
d3.select("#hover-race-name-"+runnerID.split(" ")[0].toLowerCase()).text(d.data.athlete_id);
d3.select("#hover-race-pace-"+runnerID.split(" ")[0].toLowerCase()).text("Mile "+d.data.mileShort+" pace: "+d.data.paceShort);
focus.attr("transform", "translate(" + x(d.data["mileShort"]) + "," + y(parsePace(d.data["paceShort"])) + ")");
d3.select("#hover-race-pace-"+runnerID.split(" ")[0].toLowerCase()).text("Mile "+d.data.mile+" pace: "+d.data.pace);
focus.attr("transform", "translate(" + x(d.data["mile"]) + "," + y(parsePace(d.data["pace"])) + ")");
}

function mouseout(d) {
Expand Down Expand Up @@ -414,9 +414,9 @@ function dotChart(targetID,maxval,runnerID){
.attr("r", function(d) {
if (d["Daily Elevation"] ) {
if (screen.width <= 480) {
return (d["Daily Elevation"]/1000+5)
return (d["Daily Elevation"]/1000+6)
} else {
return (d["Daily Elevation"]/500+5)
return (d["Daily Elevation"]/500+6)
}
} else {
return 5;
Expand All @@ -427,25 +427,25 @@ function dotChart(targetID,maxval,runnerID){
.attr("opacity",function(d) {
// all data displayed
if (runnerID == "all") {
if (d.Date == "2017-07-01"){
if (d.Date == "2017-07-23"){ // <------------------------------------------------------- CHANGE THIS ON MONDAY!
return 1.0;
} else {
return 0.2;
return 0.3;
}
// data just for one runner is displayed and this is the one
} else if (d.name.split(" ")[0].toLowerCase() == runnerID) {
if (d.Date == "2017-07-01"){
if (d.Date == "2017-07-23"){ // <------------------------------------------------------- CHANGE THIS ON MONDAY!
return 1.0;
} else {
return 0.3;
}
// just one runner is displayed and this is not the one
} else {
if (d.Date == "2017-07-01"){
return 0.5;
} else {
// if (d.Date == "2017-07-01"){ // <------------------------------------------------------- CHANGE THIS ON MONDAY!
// return 0.5;
// } else {
return 0.2;
}
// }
}
})
.attr("fill",function(d) {
Expand Down
2 changes: 1 addition & 1 deletion src/partials/_head_races.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
<meta property="og:title" content="<%= grunt.data.json.project.title_races %>">
<meta property="og:site_name" content="The San Francisco Chronicle">
<meta property="og:url" content="<%= grunt.data.json.project.url + grunt.data.json.project.slug_races %>">
<meta property="og:image" content="<%= grunt.data.json.project.url + grunt.data.json.project.slug_races + grunt.data.json.project.image_races %>">
<meta property="og:image" content="<%= grunt.data.json.project.url + grunt.data.json.project.image_races %>">
<meta property="og:description" content="<%= grunt.data.json.project.description_races %>">
2 changes: 1 addition & 1 deletion src/partials/_head_training.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
<meta property="og:title" content="<%= grunt.data.json.project.title_training %>">
<meta property="og:site_name" content="The San Francisco Chronicle">
<meta property="og:url" content="<%= grunt.data.json.project.url + grunt.data.json.project.slug_training %>">
<meta property="og:image" content="<%= grunt.data.json.project.url + grunt.data.json.project.slug_training + grunt.data.json.project.image_training %>">
<meta property="og:image" content="<%= grunt.data.json.project.url + grunt.data.json.project.image_training %>">
<meta property="og:description" content="<%= grunt.data.json.project.description_training %>">
44 changes: 20 additions & 24 deletions src/races/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<%= t.include("partials/_flat_nav_races.html") %>
<%= t.include("partials/_nav_races.html") %>

<div class="landing-image">
<img src="http://ww2.hdnux.com/photos/61/64/55/<%= json.sfmarathonrace['main_image'][0].WcmID %>/5/1000x0.jpg"></img>
<div class="caption top"><%= json.sfmarathonrace['main_image'][0].Caption %><span class="byline"> <%= json.sfmarathonrace['main_image'][0].Photographer %></span></div>
</div>

<div class="outer" id="content">

<div class="top-container">
Expand All @@ -42,7 +47,7 @@

<div class="inline-image">
<img src="http://ww2.hdnux.com/photos/61/64/55/<%= d.image[0].WcmID %>/5/1000x0.jpg">
<div class="caption"><%= d.image.Caption %></div>
<div class="caption"><%= d.image[0].Caption %><span class="byline"> <%= d.image[0].Photographer %></span></div>
</div>

<div class="interactive-container">
Expand All @@ -59,23 +64,12 @@
</div>
<div id="<%=d.Key%>-race"></div>
</div>
<div class="source nomargin">Source: <a href="https://www.strava.com" target="_blank">Strava</a>, <%=d.Name%>, <a href="http://www.thesfmarathon.com/" target="_blank">SF Marathon</a></div>
</div>

<% if (d.Key == "hilary"){ %>

<div class="text-pullout padded">Hilary wanted to run a time of <span class="bold-text-pullout"><%=d["Finish-goal"]%></span>
<div>and succeeded in running <span class="bold-text-pullout"><%=d["Finish-time"]%></span></div>
<div>Gene ran a time of <span class="bold-text-pullout"><%=d["Finish-time-Gene"]%></div>
</div>

<% } else { %>

<div class="text-pullout padded"><%=d.Name.split(" ")[0]%> wanted to run a time of <span class="bold-text-pullout"><%=d["Finish-goal"]%></span>
<div>and succeeded in running <span class="bold-text-pullout"><%=d["Finish-time"]%></span></div>
</div>
<div class="text-pullout centered"><%=d.Highlight.replace("**","<span class='bold-text-pullout'>").replace("*","</span>").replace("**","<span class='bold-text-pullout'>").replace("*","</span>").replace("**","<span class='bold-text-pullout'>").replace("*","</span>")%>
</div>

<% } %>
<div class="source narrow">Source: <a href="https://www.strava.com" target="_blank">Strava</a>, <%=d.Name%>, <a href="http://www.thesfmarathon.com/" target="_blank">SF Marathon</a></div>

<% d.text.forEach(function(d,idx) { %>
<p><%=d.value%></p>
Expand Down Expand Up @@ -120,16 +114,18 @@
<%= t.include("partials/_footer.html") %>

<script>
var balintData = <%= JSON.stringify(json.BalintGal) %>;
var geneData = <%= JSON.stringify(json.GeneDykes) %>;
var gregData = <%= JSON.stringify(json.GregMcQuaid) %>;
var hilaryData = <%= JSON.stringify(json.HilaryDykes) %>;
var iainData = <%= JSON.stringify(json.IainMickle) %>;
var jorgeData = <%= JSON.stringify(json.JorgeMaravilla) %>;
var laurenData = <%= JSON.stringify(json.LaurenElkins) %>;

var raceData = <%= JSON.stringify(csv.allStravaSplits) %>;
var balintData = <%= JSON.stringify(json.BalintGalRace) %>;
var geneData = <%= JSON.stringify(json.GeneDykesRace) %>;
var gregData = <%= JSON.stringify(json.GregMcQuaidRace) %>;
var hilaryData = <%= JSON.stringify(json.HilaryDykesRace) %>;
var iainData = <%= JSON.stringify(json.IainMickleRace) %>;
var jorgeData = <%= JSON.stringify(json.JorgeMaravillaRace) %>;
var laurenData = <%= JSON.stringify(json.LaurenElkinsRace) %>;

var raceData = <%= JSON.stringify(csv.raceSplits) %>;
var elevationData = <%= JSON.stringify(csv.elevationProfile2017) %>;

console.log(hilaryData);
</script>

<script src="../app-races.js" async></script>
Expand Down

0 comments on commit dc77d6c

Please sign in to comment.