Add full name to tooltip

This commit is contained in:
Jan Philipp Timme 2017-12-31 17:39:39 +01:00
parent c24d0ab10a
commit 0a58aad220
2 changed files with 7 additions and 1 deletions

View File

@ -461,7 +461,7 @@ function createLineGraph(containerId, raceData){
} }
function getLapTextArray(raceData, d){ function getLapTextArray(raceData, d){
var driverText = getDriverCodeById(raceData,d.driverId); var driverText = getDriverCodeById(raceData,d.driverId) + " - " + getDriverNameById(raceData,d.driverId);
var lapText = "Lap: " + d.lap; var lapText = "Lap: " + d.lap;
var posText = "Pos: " + d.position; var posText = "Pos: " + d.position;
var returnArr = [driverText, lapText, posText]; var returnArr = [driverText, lapText, posText];

View File

@ -85,6 +85,12 @@ function getDriverCodeAndPositionArray(raceData, lapNumber){
return posDriverCode; return posDriverCode;
} }
function getDriverNameById(raceData, driverId){
var driverData = raceData.drivers.filter(driv => driv.driverId == driverId)[0];
if(driverData === undefined) return "XXX"; // TODO: Do a real fix instead of this quick fix
return driverData.forename + " " + driverData.surname;
}
function getDriverCodeById(raceData, driverId){ function getDriverCodeById(raceData, driverId){
var driverData = raceData.drivers.filter(driv => driv.driverId == driverId)[0]; var driverData = raceData.drivers.filter(driv => driv.driverId == driverId)[0];
if(driverData === undefined) return "XXX"; // TODO: Do a real fix instead of this quick fix if(driverData === undefined) return "XXX"; // TODO: Do a real fix instead of this quick fix