# Conflicts:
#	js/diagrams.js
This commit is contained in:
Maschell 2017-12-31 01:36:02 +01:00
commit 3487c02bf6
1 changed files with 7 additions and 4 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("");
@ -82,14 +86,13 @@ function createLineGraph(containerId, raceData){
.attr("height", svgHeight);
//----------------------------------------------------------------------
// make sure we have no overlapping
svg.append("defs").append("clipPath")
.attr("id", "clip")
.append("rect")
.attr("width", graphPosWidth.width)
.attr("height", graphPosWidth.height);
var focus = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + graphPosWidth.posX + "," + graphPosWidth.posY + ")");