Merge branch 'master' of github.com:F1Vis/f1vis

This commit is contained in:
Jan Philipp Timme 2017-12-29 16:28:45 +01:00
commit 36cecd401b

View File

@ -120,9 +120,7 @@ function createLineGraph(containerId, raceData){
// in case the driver ended the race too early, get the status why he quit // in case the driver ended the race too early, get the status why he quit
/*TODO: Mouseover for Rectangle*/ /*TODO: Mouseover for Rectangle*/
var resultOfDriver = raceData.results.filter((result) => { return result.driverId == driverLapData.driver.driverId; }); var resultOfDriver = raceData.results.filter((result) => { return result.driverId == driverLapData.driver.driverId; });
console.log(resultOfDriver);
if(resultOfDriver.length > 0 && getValidEndingStatusIds().indexOf(resultOfDriver[0].statusId) < 0){ if(resultOfDriver.length > 0 && getValidEndingStatusIds().indexOf(resultOfDriver[0].statusId) < 0){
console.log("not ended properly");
var triangle = d3.symbol() var triangle = d3.symbol()
.type(d3.symbolTriangle) .type(d3.symbolTriangle)
.size(25); .size(25);
@ -173,7 +171,13 @@ function createLineGraph(containerId, raceData){
d3.axisRight(y) d3.axisRight(y)
.ticks(raceData.drivers.length) .ticks(raceData.drivers.length)
.tickFormat(function(d) { .tickFormat(function(d) {
return d + " " + getDriverCodeFromPosAndLap(raceData, raceData.lapTimes.size, d) ; var driverCode = "";
if(getDriverCodeFromPosAndLap(raceData, raceData.lapTimes.size, d)){
driverCode = getDriverCodeFromPosAndLap(raceData, raceData.lapTimes.size, d);
}else{
driverCode = getDriverCodeFromPosAndLap(raceData, raceData.lapTimes.size - 1, d);
}
return d + " " + driverCode ;
}) })
) )
.attr("transform", "translate( " + (width) + ", 0 )"); .attr("transform", "translate( " + (width) + ", 0 )");
@ -300,7 +304,9 @@ function createLineGraph(containerId, raceData){
driverCode = getDriverCodeById(raceData,raceData.results[pos -1].driverId); driverCode = getDriverCodeById(raceData,raceData.results[pos -1].driverId);
} }
}else{ }else{
//TODO hier Adden if(raceData.lapTimes.get(lapNr)[pos-1]){
driverCode = getDriverCodeById(raceData, raceData.lapTimes.get(lapNr)[pos-1].driverId);
}
} }
return driverCode; return driverCode;
} }