Fix tickValues

This commit is contained in:
Jan Philipp Timme 2017-12-31 01:03:16 +01:00
parent 20de45ae4f
commit 1a9c796c12
1 changed files with 6 additions and 2 deletions

View File

@ -45,11 +45,15 @@ function createLineGraph(containerId, raceData){
y = d3.scaleLinear().range([graphPosWidth.height, 0]),
y2 = d3.scaleLinear().range([smallGraphPosWidth.height, 0]);
var xAxis = d3.axisBottom(x),
// Gather lapNumbers for xAxis tickvalues
var lapNumbers = [];
for(var i=0; i<raceData.lapTimes.size; i++) lapNumbers.push(i);
var xAxis = d3.axisBottom(x).tickValues(lapNumbers),
yAxis = d3.axisLeft(y);
var xAxisGridlines = d3.axisBottom(x)
.ticks(raceData.lapTimes.size) // One gridline for each lap
.tickValues(lapNumbers) // One gridline for each lap
.tickSize(-graphPosWidth.height)
.tickFormat("");